# Vector3.Angle

I would have thought that the follow two debug lines would return 90 & -90 (270) but they are both returning 90. Why is this?

``````Debug.Log(Vector3.Angle(new Vector3(1,0,0), new Vector3(0,1,0)));
Debug.Log(Vector3.Angle(new Vector3(-1,0,0), new Vector3(0,1,0)));
``````

I assume the function is working correctly, so how would I get the desire result?

The angle between two vectors is always between 0 and 180 degrees. It is the angle between them and not a rotation. The angle is calculated using the dot product. See this thread for testing left and right.

Mike nailed it.

If you want to know the direction that one vector is turned relative to another (i.e. clockwise or counter-clockwise) on a reference plane, then you can compare the cross product of the two vectors and compare the resulting vector’s direction to the reference plane’s normal vector.

Given two vectors A and B (representing rotation from vector A to vector B) and given the normal vector of a reference plane, N. Using the right-hand-rule of turning with N acting as the axis of rotation, the direction of turn is given by the following algorithm:

``````  // The direction of turn from vector A to vector B relative to N.
float direction = Mathf.Sign(Vector3.Dot(Vector3.Cross(A, B), N));

If direction > 0, then the turn is clockwise.
If direction < 0, then the turn is counter-clockwise.
``````