Converting movement vector to dir vector and magnitude
How would you convert a movement vector to a directional vector and a magnitude (speed)? I know just normalizing it would give you the directional vector, but how would you extract the speed out of it? Thanks in advance
For a 3D vector
magnitude = sqrt(x*x + y*y + z*z);
Drop the z*z for a 2D vector, add a w*w for a 4D vector. This extends to any number of dimensions.
magnitude = sqrt(x*x + y*y + z*z);
Drop the z*z for a 2D vector, add a w*w for a 4D vector. This extends to any number of dimensions.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement