Hi All,
Im trying to get a vertical angle to another game object which ignores the direction the object is facing, its for a steering behaviour I am writing.
I have been working with the following code:
float angle = Vector3.Angle (transform.up, targetDirection);
float vangle = angle * Mathf.Sign (Vector3.Cross (transform.up, targetDirection).x);
which I think gives me a vertical angle, however this varies depending on wether the object is in front or behind. Ideally I just want to know what the angle is regardless of wether it is infront or behind the game object making the measurement. with 0 being horizontal -90 being directly below and 90 being directly above.
Is this possible? could anyone point me in the right direction? Cheers!