Adverti horiz upsell
Character Setup for Real-Time in Maya 3.0
Character Setup for Real-Time in Maya 3.0
sdb1987, added 2005-09-25 00:51:59 UTC 39,455 views  Rating:
(0 ratings)
Page 2 of 2

Working with translating the hips:

We will now take advantage of the concept of "freedom nodes" within Maya. The goal is to have an automatic compensation occur in the chest area whenever the hips translate. This function needs to be a toggle for the animator so the hips can also move independent of the rest of the upper body.

First, connect the root joint�s translation with the CntrlHip controller. Select the CntrlHip then the root joint and Constrain > Point. This locks down the root�s translation.

Create a locator and position it with the CntrlHip. Have its pivot point at the root joint. Name it freedomHip, freeze transformations and hide it.



How we will use the freedomHip:

We will use the freedomHip to drive the counter balance action of the chest when the hips translate. To do this we need to have the freedomHip have the same driven keys as the CntrlHip. We can then modify the freedomHip�s driven keys to affect the upper spine through an expression. In addition, we will have this function as a toggle the animator can turn on or off through a custom attribute.

First, add three new attributes to the freedomHip (freedomRollX, freedomRollY and freedomRollZ). Have them as float with the min at �10, max at 10 and the default at 0. Now, create a series of set driven keys on the new attributes exactly the same as we did with the SpineRoll attributes on the CntrlHip. Once finished, we have in essence two sets of attributes controlling the rotation of the lumbar and thoracic joints.

Toggle Time:

On the CntrlHip create a custom attribute named Offset with the type as integer and a min of 0, max of 1 and default at 0. This attribute is the toggle to have the skeleton automatically try to balance out the translation of the hips.

Expression Time:

In the Expression Editor write the following expression naming it offsetExp:

if (CntrlHip.Offset > 0)

{

freedomHip.freedomRollX = -CntrlHip.translateZ;

freedomHip.freedomRollZ = CntrlHip.translateX * 1.5;

CntrlChest.ChestRollZ = CntrlHip.translateX * 4;

CntrlHipG.rotateZ = CntrlHip.translateX * 10;

CntrlHipG.rotateX = -CntrlHip.translateZ * 8;

}

This expression says that if the Offset attribute is on (a value of 1) have the translation of the CntrlHip affect the value of the freedomRoll attributes thus updating the rotation of the spine joints. To see the effect translate the CntrlHip in both the Z and X.



Add the shoulderRollExp:

This expression helps the shoulders compensate for the spine joints rotation in the X axis:



if (CntrlChestG.rotateX > 0)

CntrlChestG.rotateX = CntrlHip.spineRollX * 12;

else

CntrlChestG.rotateX = CntrlHip.spineRollX * 8;



The balance expression:

Now, let�s say we are animating the character walking around. It would be convenient to have the body move automatically whenever the character takes a step. We can accomplish this easily through an expression. Remember though, with any type of automation it is wise to give the animator the ability to turn it on or off. So, with the CntrlBody selected, add a custom attribute called Balance (integer type with a min of 0, max of 1 and default at 0).

Now create the following expression in the Expression Editor and name it balanceExp:

if (CntrlBody.Balance > 0)

{

CntrlBodyG.translateX = (CntrlLankle.translateX + CntrlRankle.translateX)/2;

CntrlBodyG.translateZ = (CntrlLankle.translateZ + CntrlRankle.translateZ)/2;

CntrlBodyG.rotateZ = (-CntrlRankle.translateY * 2.5) + (CntrlLankle.translateY * 2.5);

CntrlBodyG.rotateX = (-CntrlRankle.translateY * 2) + (-CntrlLankle.translateY * 2);

CntrlChestG.rotateZ = -CntrlHip.rotateZ/2 + ((CntrlRankle.translateY * 2) + (-CntrlLankle.translateY *2));

}

Notice in the expression the use of the "freedom nodes" like the CntrlBodyG is the node that the expression writes to. This way we still have freedom to manipulate the actual CntrlBody node independently of the expression.

Now turn the Balance attribute on (to 1) and move the CntrlLankle around. Notice the rest of the body trying to compensate and balance itself out.



These expressions should familiarize you with how to have an attribute or set of attributes "drive" another objects attribute(s). You should now be able to construct some other expressions that involve the body reacting and counteracting to the movement of various joints.

In addition, you can create some shoulder controls to drive the placement of the shoulder joints independent of the body. Create some controllers and have the shoulder joints point constrained to the controllers. Make sure the controls are children of the cervical joint so they will come along for the spine roll ride.

To review, we have used a combination of primarily set driven keys using custom attributes and applied some expressions to create a functional and manageable spine setup.