I am making a 2D game in Unity, and from what I understand, their convention is that an angle of 0 is up and increasing the angle rotates the object counter-clockwise.
Sidenote: I made this assumption by looking at the
rotation.zvalue in a transform's Inspector window. When it is 0, the object's
transform.uppoints towards positive y. Increasing
rotation.zrotates the object counter-clockwise, i.e. the object's
transform.uppoints to negative X at an angle of 90 degrees. Let me know if this is wrong.
Considering the convention, where increasing the angle rotates counter-clockwise, what should my extension method
Vector2.Rotate(this Vector2 vector, float angle) do?
My question is whether doing
Vector2.up.Rotate(90) would result in a clockwise or counter-clockwise rotation, where clockwise would give
Vector2.right and counter-clockwise would give
At first it seemed initiative to me that it would obviously rotate clockwise. It's a positive number so therefore it rotates clockwise. I'm not sure where that bias comes from, but using
Rotate(90) feels like it should rotate it to the right (clockwise).
After reasoning about it, I think it would make more sense to have
Rotate(90) rotate counter-clockwise. Because the universe assumes higher/positive angle results in counter-clockwise rotation, the method must also respect that rule. But for some reason it doesn't seem intuitive to me that to rotate something clockwise, I would have to call Rotate with a negative number,
Rotate(-90) // clockwise.
Is there an evidence-based way to make this decision?