Gimbal Lock

by Stefan Andersson


Synopsis.
The gimbal lock is caused by X and Z axis being in the same order after rotating the Y axis 90/-90 degrees. And this will give you no control over those axis. For more in-depth information about Gimbal Lock I recommend that you visit this webpage: http://www.anticz.com/eularqua.htm

note: this happen with rotating in add mode. Rotations should always be animated with the add mode (unless you like problems). This tutorial also requires basic knowledge of expressions.

Problems and solving.
One definite problem we have is the order of X,Y,Z. To solve rotations we need to change what is effecting what and how we can get around the problem. In this case (a hip for a character) we need to change the order to Y,Z,X. Why? The problem with gimbal lock occurs when the Y rotation is only effecting one axis and not two. So we move the Y to be on the top of the chain. And how do we do this?

Step 1. Nulls
We need to create three nulls and name the as the axis we want to control.



Now make the Y null the parent over the Z null and then the Z null the parent of the X null. At this point we have changed the order of what axis controls which axis (change colors if you want it'll be easier to see what they are up to when you animate).

Now make a wiresphere to be the control null for the rotation.

Download wiresphere and drop it in the viewport [ wiresphere.scn ]
Download skeleton rig and drop it in the viewport [ skeleton.scn ]

note: when merging scenes XSI parent them under a Null so you might want to cut the models/wireobjects so that they are under the root of the scene.

Align the Nulls to the center of the Skeleton_Null. Make the X_Null the parent to the root of the hip.



Position constraint the Y_Null to the wiresphere. this is so that the center of the body follows the sphere when it's being translated. We now need to make expressions on the nulls.

Step 2. "keep it simple"

The expression part is probably the easy part for this. Select the Wiresphere and press CTRL-K to open up it's kinematics property. Lock the window by clicking on the keyhole button.



Now select the Y_Null and CTRL-K to open up the same window. Now right click on the Y rotation.



Select set expression and the expression window appear (delete the numbers in the window). OK, now for a really nice XSI feature. Click drag on the Y rotation from the wiresphere's kinematic window, release it in the expression window. Aha! press apply and close the expression window.



The Y_Null's Y rotation is now being controlled by the Wiresphere's Y rotation. Do the same with the Z and X nulls (controlled by Z and X from the wiresphere).

To finish it of you make another Null that you scale up and make it the Translation null for the character. Position constraint the wiresphere to the Null.

Step 3. "will it work?"

The best way to work with add rotation is to think about "what axis is rotation the character in what direction?". And know your mouse buttons. Don't be fooled about the visual axis that's on the sphere, trust what you know about the XYZ rotations from your mouse.

Y rotation (middle mouse button), turns around your character.
Z rotation (right mouse button), side to side
X rotation (left mouse button), bends forward and backwards.

Download the finished scene no_more_gimbal.scn



Have fun!

Stefan Andersson
Character Animator
Filmtecknarna F. Animation