Thursday, August 29, 2013

Zero out Rotation Axis in Maya

A small but niggling problem with Maya rigging comes about when orienting joints. If (like me), you like to adjust your joints' local rotation axis by using component mode, you will notice that once you finish, the rotation will follow the new local rotation axis, but the translate won't. This can cause problems for moving joints and animating further down the track.

The problem arises from the fact that Maya stores changes to the local rotation axis in a special attribute on your joint called "Rotate Axis". When you finish your skeleton, you should always have zeroed Rotate Axis values:

By zeroing out the Rotation Axis value of a joint, you can make that everything is working correctly when you finish rigging and are ready to animate. You can think of it as a type of "freeze transform" for joint orients.

Let's take the following example:

  1. The spine directions do not match, even after orienting joints.
  2. The direction has been fixed by going into the component editor,  selecting the joint and rotating it 180 degrees in x using the following MEL snippet:
  3. rotate -r -os 180 0 0;

  4. Back in object mode, the rotation is now correctly facing the same way on all joints.
  5. However the translate is not. Select all the joints and use the following piece of MEL to zero out the joint's Rotate Axis value:

  6. joint -e -zso; 

  7. Now everything is correctly aligned to the local rotation axis value.
Alternatively, you can download the oc_jointOrient script to do the job:
It also has a handy right click feature which allows you to rotate discretely without having to type in any MEL:

No comments:

Post a Comment