I am looking to find a way to get the Compass orientation of a 3D Vector object. I need a result in degrees from 0 to 360.

The way i could know the orientation of the object.

Here is what i did so far, but it does not seem to work.

I can't understand why..

var objectForwardVector : Vector3 = object.transform.forward; var worldForwardVector : Vector3 = object.transform.forward; objectForwardVector.x = 0; objectForwardVector.Normalize(); worldForwardVector.Normalize(); var dotProduct : float = (objectForwardVector, worldForwardVector); return Acos( dotProduct ) /Math.Pi * 180;Right now, the Compass value change when i move my object on the Longitudinal Axis. (whatever the Longitudinal axis, the Compass orientation should be the same).

anyway, it look strange..

Any idea on that ?

Thank you in advance for any help !

Regards.

*'Edit'* changed int to float..