How to get move direction of a part?(For example, ball?)

The title explains it all already. If anyone can help, I will appreciate that very much!

The AssemblyLinearVelocity property is a Vector from which you can get both speed (magnitude of velocity) and direction of velocity.

Depending on your use case, it may be useful to get the unit vector of AssemblyLinearVelocity (AssemblyLinearVelocity.Unit). The length of a unit vector is always one when the unit vector is defined (it’s not defined for a zero vector).

The unit vector can be used to get a vector with the same direction but an arbitrary length. You can also use it for it calculating the angle between the vector and the xz-plane which is math.asin(unitVector.Y) or calculating the horizontal angle with math.atan2 using the X and Z components (for math.atan2, you can also use the components of the original vector, though).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.