Rigging Characters for Animation, Pt. 2, From New Riders | WebReference

Rigging Characters for Animation, Pt. 2, From New Riders

'; figDoc.write(zhtm); figDoc.close(); } // modified 3.1.99 RWE v4.1 -->

Inside Maya: Rigging Characters for Animation. Pt. 2.

This book excerpt is from Erick Miller's "Inside Maya 5." ISBN 0735712530. All rights reserved. Chapter 17: Rigging Characters for Animation, is posted with permission from New Riders.

Advanced Stretchy IK Legs and Classic Reverse Foot

The Jerk's legs will be rigged up in a similar way to the spine: They will be capable of stretching when the distance between the foot and the hips becomes larger. This is an interesting setup because it causes the foot to stay stuck to the ground, even if the character's root is causing the leg to stretch just a small amount. This capability allows for the animator to hit nice key poses in a walk, or any other pose that involves planting one foot and moving another, without having to worry too much about the terrible "IK snapping" of joints as the IK handle moves too far away from the joint and it can no longer bend to achieve the pose.

In the next exercise, you set up the leg joints so that they will stretch and the animator will never have to worry about this problem.

Exercise 17.5 Classic Reverse Foot Setup

The foot will be set up using a classic reverse foot setup. This simple technique allows the foot to be rotated from all three pivots that a real foot's weight lands upon while walking: the heel, the ball, and the toe. This makes for a very straightforward time when animating the feet for a walk cycle of a character.

  1. Start by opening the file Jerk_IkLegs_Begin.mb on the CD for this chapter.

  2. Next, activate the rotate plane IK Handle tool by going to Skeleton, IK Handle Options and hitting the Reset Tool button. Using the IK Handle tool, create an IK handle from the leg joint to the ankle joint, then from the ankle joint to the ball joint, and finally from the ball joint to the toe joint. Your result should look like Figure 17.37.

    Figure 17.37
    The leg after creating the necessary IK handles.

  3. Next, rename all your IK handles to match the portions of the leg and foot that they correspond to—ankle_ikHandle, ball_ikHandle, and toe_ikHandle.

  4. Now create the reverse foot. Start by drawing a backward foot joint hierarchy. The root of this new joint hierarchy should start at the base of the heel and then move to the toe, the ball, and the ankle. Name your hierarchy reverseHeel, reverseToe, reverseBall, and reverseAnkle, accordingly. Your result should look like Figure 17.38.

    Figure 17.38
    The reverse foot joint hierarchy.

  5. Next, parent the ankle IK handle to the reverseAnkle joint. Parent the ball IK handle to the reverseBall joint, and parent the toe IK handle to the reverseToe joint, as in Figure 17.39.

    Figure 17.39
    IK handle relationship in the reverse foot joint hierarchy.

  6. Create three locators that will be pole vector constraints for the leg and feet IK handles. Name the first locator ballPoleVector. Keeping the v key pressed down and using the middle mouse button with the Move tool, point-snap this locator to the reverseAnkle node and make it a child of reverseAnkle. Next, select the ballPoleVector locator that you just parented, Shift+select the ball_ikHandle, and perform Constrain, Pole Vector. Move the locator so that it is off to the side of the foot, not right on top of the ankle joint.

  7. Name the second locator toePoleVector, and point-snap and parent it to the reverseBall joint. Next, select it along with the toe_ikHandle and perform Constrain, Pole Vector. Also move this locator so that it is off to the side of the foot, not right on top of the ball joint.

  8. Finally, name the third locator legPoleVector, and point-snap it to the legJoint; then move it out in front of the knee joint. Parent this locator to the Hips joint. Select this locator, and Shift+select the ankleIk handle and again perform Constrain, Pole Vector. Your result should look like Figure 17.40

    The reverse foot setup is completed, and is ready to be animated.

  9. You can animate the reverseHeel, reverseToe, and reverseBall joints to make the character's foot roll as it is walking. Also hide the locators and IK handles that are children of the reverse foot hierarchy so that they aren't accidentally animated or selected.

    Now you can create your stretchy legs setup.

    Figure 17.40
    Pole vector constraint for the leg.

  10. Create a distance dimension node from the leg to the ankle with the measuring tool by using the menu command Create, Measuring Tools, Distance Tool. Click first on the leg joint and then on the ankle joint. Now point-constrain the first locator of the distance tool to the leg joint; point-constrain the second locator of the distance tool to the ankle_ikHandle, which spans from the leg joint to the ankle joint, using Constrain, Point (see Figure 17.41).

  11. Next, open the Create Render Node window from the Hypershade window under Create, Create New Node, and create the following utility nodes:

    • Three multiplyDivide nodes

    • Two plusMinusAverage nodes

    • One condition node

    Figure 17.42 shows the result.

    Figure 17.41
    Creating a distance dimension node for the leg.

    Figure 17.42
    Creating utility nodes for the leg.

    Next, you'll hook up a node network that will allow the legs to stretch as the distance between the ankle's IK handle and the leg joint becomes greater.

    To start, you'll create some attributes that can be used to easily control the stretching capabilities of the leg.

  12. Select the reverseHeel joint. This will be the node that you add the additional attributes onto because this is also the joint that you can use to animate the position of the foot. Go to the menu item Modify, Add Attributes and add the following attributes:

    • autoStretch min: 0, max: 1—This is so that the automatic stretching can be blended on and off.

    • shortenTolerance min: 0, max: 1—This attribute will control how short the leg gets before it starts to bend.

    • legScale min: 0, max: 10—This is an extra control that allows the leg to scale on top of the automatic scale.

    Figure 17.43 shows the result.

    Figure 17.43
    The new leg attributes are ready to be connected.

    Now you'll connect all the nodes and attributes that you just created to get the controllable automatic stretchy reaction that you want from the leg.

  13. Connect the distanceDimensionShape.distance attribute to the multiplyDivide1.input1Y attribute. Set the operation mode of multiplyDivide1 node to Divide. Next, copy and paste the number from input1Y (using Ctrl+c and Ctrl+v) into the input2Y attribute of the multiplyDivide1 node.

  14. Next, connect the multiplyDivide1 outputY to the plusMinusAverage1 input1D[0] attribute. Make sure that the plusMinusAverage1 node's operation is set to Subtract. Also make sure that the multipyDivide1 node's input2Z attribute is set to 1. Then connect it to the plusMinusAverate input1D[1] attribute (to subtract 1 from the output).

  15. Connect the plusMinusAverage1 node's output1D to the multiplyDivide2 node's input2Y. Connect the reverseHeel's autoStretch attribute into the input1Y attribute of the multiplyDivide2 node.

  16. Connect the multiplyDivide node's outputY attribute to the plusMinusAverage node's input1D[0]. Then set the multiplyDivide2 node's input2z attribute to 1 and connect it to the input1D[1] attribute of the plusMinusAverage2 node.

  17. Set the operation mode of the condition1 node to Less Than, and connect the plusMinusAverage2 node's output1D attribute to the condition node's colorIfFalseG attribute. Then connect the plusMinusAverage2 node's output1D attribute to the condition node's firstTerm attribute. Next, connect reverseHeel's shortenTolerance attribute to the condition node's secondTerm attribute, and also connect reverseHeel's shortenTolerance attribute to the condition node's colorIfTrueG attribute.

  18. Next, connect the condition1 node's outColorG to the last multiplyDivide3 node's input1Y attribute. Connect reverseHeel's attribute legScale to multiplyDivide3's input2Y attribute.

  19. Finally, connect the outputY attribute of the multiplyDivide3 node into the scaleX attributes of the leg and the knee joint nodes.

    Your final node network should look similar to Figure 17.44.

    Figure 17.44
    The final node network for the stretchy leg.

You can now animate the reverse feet, and the leg will actually stretch to compensate for the overextension of the foot. The attributes to control this reaction are right on the reverseHeel, so you can keyframe this behavior on and off and scale the legs on top of it. The completed scene file appears on the accompanying CD as Jerk_IkLegs_Finished.mb.

Created: March 27, 2003
Revised: November 7, 2003

URL: http://webreference.com/3d/insidemaya/2