Orientation (Rotation) Euler angles
As mentioned in the previous article, all bones have an orientation (rotation). This orientation mainly affects how constraints behave, but can also have an effect on IK solvers.
How does rotation even work in 3D? (Euler gimbal)
The easiest/most comprehensible way of storing rotation is by having 3 axes, that affect each other in an order.
Unity lets you rotate objects this way, however behind the curtains all rotations are stored as quaternions (another more confusing way of storing rotation).
This GIF shows an order of X Y Z (Red-Green-Blue)
This order heavily affects how objects rotate, this is pretty important to know when you want an object to rotate around one axis.
In the GIF below you can see, that using the order XYZ causes you to have to rotate all 3 axes for the object to appear to rotate around one.
ZYX works, because the object is aligned to its Z axis, and Z is the last axis in the ZYX order
However we cannot change the Euler order in unity, so we need to align the objects at rest (at rest meaning that the rotation is 0,0,0)
The order unity uses is XZY, this means that objects should be aligned with the X axis at rest.
All of this also applies to bones
1 Comment
Didn't know Z axis alignment was so important, thanks for clarifying!
That makes it a little more frustrating that exporting out of Blender into Unity tends to switch axes around (by default)