Transform.Rotate
has a very helpful interface for selecting whether or not a rotation should be made relative to world axes or the local axes.
Behind the scenes, it's doing some math to the transform's rotation
, a Quaternion
, with another Quaternion
. And the exact nature of this math changes depending on if you choose the local or world flag.
How can I do this sort of math without assigning the first Quaternion
to a Transform's rotation
(wasting memory and/or time) just to do some math with it?
Suppose my first Quaternion
is Quaternion q1 = Quaternion.Euler(0f,0f,90f);
and the second is Quaternion q2 = Quaternion.Euler(90f,0f,0f)
.
Applying the second to the first along its local axes would give a rotation that rotates its right side to face down and its front to face right.
Applying the second to the first along the original axes would give a rotation that rotates its back to face down and its top to face right.