Chances are you've heard the term 'Gimbal
L'ock at least once before. But what is it exactly, and how can we
avoid it? What even is a gimbal, or a lock? (okay, maybe you're
not asking yourself the last one)... Hi I'm Skitty, and these are some of the
questions we're gonna dive into today. Before we can understand, well... this,
we need to back up and understand this. This, is a system of suspended rotatable
rings, or a gimbal. The gimbal system is most
identifiable in gyroscopes, but it also resembles our rotation manipulator in
Maya. Gimbal rings are nested inside each
other, and are parented from the inside- out, so the innermost ring can rotate
independently, while also being affected by each ring outside of it.
Each ring can only rotate on one axis, described as 'pitch',
'yaw', and 'roll'. In Maya, we know these as 'X' 'Y' and 'Z' rotations. If we look at the
gimbal's hierarchy, the outermost ring will be the parent, the
middle ring is the child, and the innermost ring is the grandchild.
The parent rotates the child, but the child doesn't rotate the parent.
Back in the early 1700s, a Swiss mathematician,
physicist, astronomer, geographer, logician, and engineer named Leonhard Euler made a
bunch of revolutionary mathematic equations that are still used in modern
3D software. In fact, he innovated on so many
different fields that some of his discoveries were attributed to the first
person to prove them after Euler, in an attempt to not make
everything named after him. One of these equations was Euler's
Rotation Theorem. This is an XYZ rotation system allowing
each axis to have its own rotational curves around a fixed center origin
point. Sound familiar? So why is this important?
well, even though we can't see our manipulator
axis change when we rotate in maya, if we change our axis orientation to
gimbal mode, we can see it actually is, just behind the scenes. Now we can
talk about how this system is prone to gimbal lock.
Gimbal lock occurs when an axis is rotated to the point of lining up
parallel to another axis, losing the ability to rotate from a
third axis. If you are rotating your manipulator in object mode without
the use of a third rotation, Maya will try to find a new way to make
the rotation using all three axes. Calling it gimbal lock is a bit
misleading because your gimbal isn't actually
'locked'. It can still move freely, it just can't accommodate that third axis.
These Maya interpreted rotations cause unusual arcs in your animation,
sometimes even causing the object to throw itself in a full loop.
What we need to be mindful of is that it's a child's rotation
locking into a parent rotation. So if we know what our object's rotation order is,
we won't have to worry about the axis at the top of the parent chain.
Gimbal lock is an inevitable possibility when working with three or fewer gimbal
rings. In that sense an easy solution would be
to add a fourth ring, but that doesn't help us from a 3D software perspective.
There ARE a few fixes and preventative measures we CAN use
though. The most common and simple fix, is to apply an Euler Filter to your curves
from the curves tab in the graph editor. This takes your
animation, analyzes it for rotational spikes,
and moves the gimbal ring's rotation in a way that doesn't change the object's
position, but remaps the Euler Angles to a
position that is better comparable to the Euler Angles on the other set keys.
Always double-check your curves after applying an Euler Filter though, because
Maya isn't an animator, so it can only guess what looks good based on math.
On the off chance the Euler Filter didn't give you a desirable result,
you can delete the key to reposition it manually, or check any rotation values
for spikes yourself. Anything over 180 degrees is at risk for
gimbal lock. To prevent gimbal lock before it happens,
check the curves in your graph editor for spikes regularly.
If you find yourself prone to gimbal lock, you could take what I call the
'overkill method' and zero out your character before making each pose,
or just animate in gimbal mode so you know exactly where things are
at any given time. Now that we understand how gimbal lock occurs, it should at
least be a little bit easier to avoid it in the future.
Leave a comment below if there's something you didn't understand, like and
subscribe if you learned something, links to socials are in the description and
remember to always use a reference!