how to get the GameObjects rotation around transform.up
__
__
im using transform.Rotate(Vector3.up, mouseInput.x);
to rotate the GameObject
I dont care is the rotation is a normalized Vector3
, quaternion
, or float
how to get the GameObjects rotation around transform.up
__
im using transform.Rotate(Vector3.up, mouseInput.x);
to rotate the GameObject
I dont care is the rotation is a normalized Vector3
, quaternion
, or float
[EDIT: replaced manual calculation with Vector3.SignedAngle()]
Hi,
you probably want to look at Vector3.SignedAngle
However, this is actually not easy to answer, because it is not 100% clear, what angle you mean. The angle between what two axes? The problem with the euler representation of rotations by a series of rotations around local axes (like in your illustration), is that there are multiple ways to reach the same result. Check out the gimbal lock problem Gimbal lock - Wikipedia .
I assume you may want the angle Vector3.SignedAngle(Vector3.foward, transform.forward, transform.up)
, but I am not sure. Maybe it’s rather Vector3.SignedAngle(Vector3.foward, transform.forward, Vector3.up)
what you want.
Hope this helps.