# How can I find the Velocity Angle?

Okay so I Have an object that is a rocket. I give this rocket velocity by using: rigidbody2D.AddForce(rigidbody2D.transform.up * Speed);

My question is how can I find the angle of the velocity that the ship is current moving?

For example, If I travel straight up, the angle is 90 degrees. But if I instantly turn it to the right, the angle would be 0. However if I continue to apply thrust to the right, the ship will take awhile to be fully moving to the right. The ship will still have velocity pushing it upwards too. So I need to find the angle which the velocity is. The reason I need this is because of a path prediction.

Let me know if you need more clarification.

Thanks

A vector can be described as either a direction with a magnitude or a point. To represent a vector it needs to in terms of an axis, ie. world space or local space in Unity. A vector itself is a representation or relativity.

Given this, it is quite obvious that a vector doesn’t have an angle. However, that doesn’t mean you can’t get the angle of a vector relative to another vector. In your case it seems like you want the angle between your velocity vector and a vector along the x axis in the positive direction of world space, ie. Vector2.right.

For this you can use Vector2.Angle to find what you are looking for.

That said, you mentioned you were using the angle for path prediction. It is most likely the case that you could simply use some vector algebra to achieve the same thing. Vectors are nice because they make things easy, it would be a shame not to utilize this to the fullest.

You can also first convert your vector into a Quaternion rotation and then get the x value of the rotation. This has the advantage of not loosing direction information when your vector is in the relative 3rd and 4th quadrants, but the same can be achieved by checking such cases.