The documentation on this function is… confusing.
There’s two problems:
- "The angle returned is the signed acute clockwise angle between the two vectors. This means the smaller of the two possible angles between the two vectors is used. The result is never greater than 180 degrees or smaller than -180 degrees.
Last I checked, “acute” angle means “less than 90 degrees”. It might be that I’ve missed something, but your definition seems mutually exclusive? Unless what you’re trying to do is to make up the term “signed acute”, and then define it in the second sentence. Which is a mess.
This would be a lot easier to read as a shorter explanation with examples:
"The angle returned is the signed clockwise angle between the two vectors. The result is never greater than 180 degrees or smaller than -180 degrees.
Example:
print(Vector2.SignedAngle(new Vector2(0, 1), new Vector2(0, 1)); //prints “90”
print(Vector2.SignedAngle(new Vector2(1, 1), new Vector2(0, -1)); //prints “-135”
"
- Either the implementation is wrong, or the documentation is wrong. The documentation states that these are clockwise angles. But:
Vector2.SignedAngle(Vector2.up, Vector2.right); //gives -90
Vector2.SignedAngle(Vector2.up, Vector2.left); //gives 90
Which means that looking at the vectors from the standard 2D camera, the angles given are counterclockwise.
I kinda get what’s happening; Vector2.SignedAngle corresponds to Vector3.SignedAngle with the up-axis defined as Vector3.forward. Which is… a definition, sure. But that’s not a clockwise angle! Unless I’m completely missing something, which might be the case.