So i have the following dilemma:
It’s nothing complex, you just want a force that pushes against the direction an object is moving, that scales with the square of its speed.****
How do i calculate sqrt magnitude?
linvel is linear velocity in Vector3 format {x,y,z}
dot is dot product
sqrt is squared root?
Here's an example of code i got so far, but it's wrong:
let drag = -0.1; // coefficient?
let drag_force = drag
* velocity.linvel.normalize() //normalized
* ((velocity.linvel.dot(velocity.linvel)).simd_sqrt()); // sqared magnitude?