Inverse Kinematics

table of contents

With the skeleton in place, you could now bind the character to the skeleton if you wanted. However, at this point, the skeleton only has Forward Kinematic (FK) linkages. By this, we mean that to animate, you must start at the root, and work your way to the end of the chain. For example, if a character is going to pick up a remote control, you would animate the torso leaning over, then the bicep extending, and then the forearm's rotation, and hope that the hand could approach wherever the remote control is placed (see Figure 11.7A and 11.7B). For much character animation, this type of approach is cumbersome and results in awkward character animation. Note that sometimes FK is actually more desirablefor example, if a character is bowling and the arm is to freely rotate in an arc. Maya provides tools for setting a key to toggle FK and IK for a joint.

Figure 11.7A and 11.7B. Adjusting arm position with IK versus FK.

graphics/11fig07.gif

Inverse Kinematics (or IK for short) looks at it the other way around. In our example, you would simply position the hand (now the "end effector") over the remote control, and the body from the shoulder forward would bend however necessary to reach the remote control. As you can imagine, IK might cause ridiculous contortions as it seeks a "solution" to pose the character, such that the two ends of the skeleton chain are placed as desired. There are a variety of ways to set up IK so that certain joints take precedence, and are moved before other joints. You can also set joint preferences and limits, so that knees don't bend backward and only bend to their natural limits, for example. You can also set limits and resistance levels so that as one joint nears its defined rotational limit, more of the required rotation is applied to other joints.

IK in Maya comes in three types: rotate plane, single chain, and spline.

Rotate plane is best for joint chains where the individual joints tend to rotate within a plane, even though the plane itself may rotate. Think of it as starting at a ball joint, but using hinges for the remaining joints. The animator is free to set the plane orientation with this IK type. For example, the shoulder may change rotation to set the rotate plane for the forearm and bicep, but the forearm and bicep will rotate within this plane. Using rotate plane IK, you directly control the rotate plane orientationin the previous example, the shoulder rotation. You'll use the rotate plane for typical arms and legs.

Single chain is similar to rotate plane in that the starting joint is a ball joint, free to rotate in all directions. However, instead of allowing the animator to directly pose the rotate plane for the remaining joints, the single chain type will pose all the joints according to how the IK is set up. Joints within the chain may have absolute limits beyond which they stop rotating, as well as " damping ," where the joint begins to resist rotation, transferring the rotation to other joints to achieve the pose. In any case, the joint setups will completely determine how Maya poses the joints between the start and end joints of the IK chain.

Spline is a unique type of IK designed for more serpentine joint chains. Bullwhips, tentacles, and tails are ideal for this IK type. A NURBS curve serves as the handle, and the joints are repositioned as you modify the original curve.

Next we'll add IK to the character's arms and legs. We'll also add some rings around the character's hands and feet to make it easy to select and move these appendages.

Tutorial: Setting Up Inverse Kinematics

Now we'll add IK handles to the skeleton. These will allow us to control the position of the entire body by pulling on the end effectorsthe hands and feet.

  1. Toggle visibility off for the BoxBoy mesh, so you can work directly with the skeleton. Switch to the Perspective view and orbit the view so that you can see from the character's right shoulder to right wrist. Bring up the IK Handle Tool options with Hotbox Skeleton IK Handle Tool option box. In the dialog that appears, reset the settings. The current Solver is set to the ikRPsolver. This is the rotate plane solver, which works well for bicep-forearm relationships where the limb bends within a planethat is, the forearm and bicep are "hinged" and rotate about one axis only. Therefore, the bicep-forearm combination rotates within one plane at all times. Close the dialog.

    graphics/ch11b_icon.gif graphics/ch11c_icon.gif
  2. On the character's right arm, click on the shoulder joint (the ball at the end of the joint, not the linkage), followed by wrist joint. An IK handle should appear. Switch to Move mode (hotkey: w ) and reposition the IK handle that appears at the wrist. Note how the movement stays within a plane defined by the white "pointer" in the circle that appears at the shoulder, as shown in Figure 11.8. This orientation is caused by creating the IK handle in the Top view. Undo your moves with hotkey z . In the Channel Box, rename the IK handle to IKrighthand.

    Figure 11.8. The rotate plane IK handle keeps bicep-forearm motion in the plane indicated by the white pointer at the shoulder.

    graphics/11fig08.gif

    Next we'll set the arm's IK pose to be the preferred angle. This is important for proper IK animationwhen creating bones, you will usually want to have them slightly bent in the angle they would naturally bend in. Then you can set this as the preferred angle for the IK chain. For the right arm, simply hold down the RMB over the IK handle, which should still be selected. A marking menu will appear, and you can drag over the Set Preferred Angle option.

  3. Switch to the Top view and repeat Steps 1 and 2 for the character's left arm, connecting shoulder to wrist with the IK Handle Tool. Rename the IK handle to IKlefthand and set the pose as the preferred angle.

  4. Now we'll do a little character rigging: Create a NURBS circle with Hotbox Create NURBS Primitives Circle. In the Channel Box, set the translate to 1.4, 3, 0; the rotate to 0, 0, 90; and the scaling to 0.2, 0.2, 0.2. The circle should now be around the character's left hand, like a bracelet. This makes for easy selection and animation. Name the circle Left_Hand.

  5. Duplicate the circle with Hotbox Edit Duplicate option box, reset the settings, and click Duplicate. Name the duplicate to Right_Hand. Change the Translate X value to -1.4 for this duplicated circle. Shift-select both circles, and freeze their transforms with Hotbox Modify Freeze Transformations. This sets the Channel Box values back to the initial state. Create a layer called SelectionRings and add the two circles to this layer.

  6. Select the IK handle named IKrighthand (use the Outliner if you have trouble selecting it). Now, shift-select the Right_Hand circle in the Perspective view, and choose Hotbox Edit Parent option box. Make sure that Preserve Position is checked, and click Parent. Test this by selecting the circle and moving it, as shown in Figure 11.9 (don't forget to undo). Repeat these steps for IKlefthand and the Left_Hand circle, making sure to select the parent (which is the circle) last, before typing the hotkey p to parent.

    Figure 11.9. Testing the circle as a hand controller.

    graphics/11fig09.gif

    Next we'll add IK to the legs, but using a different type of solverthe single chain type. This type of IK will allow Maya to set the plane orientation, which will keep the knees straight ahead by default.

  7. Switch to the Perspective view. Bring up the IK Handle Tool options with Hotbox Skeleton IK Handle Tool option box. Set the current Solver to the ikSCsolver. Close the dialog. The "+" cursor indicates that you should now apply IK to a joint chain. Click the hip joint of the left leg, and then click the ankle joint. The IK handle will appear.

  8. Switch to the Perspective view and move the IK handle around to see its effect on the leg. Name the IK handle as IKleftleg.

  9. Select the thigh joint of the right leg. Switch back to the Side view, and choose Hotbox Show Isolate Select View Selected. This is a fast way to hide all unselected objects. Now choose Hotbox Skeleton IK Handle Tool, click the hip joint, and then click the ankle joint. Name the created IK handle as IKrightLeg. Now turn off the Isolate mode by choosing Hotbox Show Isolate Select View Selected, which will uncheck the option and restore all the other objects. Select each IK handle, and then RMB over the handle and choose Set Preferred Angle. This will keep the legs bending along this angle when you raise the knees.

  10. Next we'll make circles for the feet: Create a NURBS circle with Hotbox Create NURBS Primitives Circle. In the Channel Box, set the translate to 0.45, 0, 0.17, and the scaling to 0.3, 0.3, 0.5. The circle should now be around the character's left foot . Name the circle Left_Foot.

  11. Duplicate the circle with Hotbox Edit Duplicate. Name the duplicate to Right_Foot. Change the Translate X value to -0.45 for this duplicated circle. Shift-select both circles, and freeze their transforms with Hotbox Modify Freeze Transformations. Add the two circles to the SelectionRings layer.

  12. Select the IK handle named IKrightleg (use the Outliner if you have trouble selecting it). Now, shift-select the Right_Foot circle and parent (hotkey: p ). Repeat these steps for IKleftleg and the Left_Foot circle. Test the circles and the IK by selecting each circle and moving it, as shown in Figure 11.10. Undo the moves when done. Unhide the BoxBoy layer, and try moving the ring handles againyou can observe how the skeleton is positioned within the character.

    Figure 11.10. Testing the leg IK and circle handles.

    graphics/11fig10.gif

  13. Lastly we'll add a selection ring to the waist and connect it to the root joint for the character. Create a NURBS circle as before, and set its Translate Y to 2.2, and its scale to 0.5, 0.5, 0.5. Rename the circle to Waist. Assign this to the SelectionRings layer. Freeze the transform with Hotbox Modify Freeze Transformations.

  14. Select any joint of the character. Because the joints are automatically created as a hierarchy, you can traverse the skeleton with the up- and down-arrow keys, just as with other grouped or parented objects. Click the up-arrow key until the entire skeleton is selected. Shift-select the circle, and parent the skeleton to the circle (hotkey: p ). Select the circle and test the effect on the skeleton when the circle is moved, as shown in Figure 11.11. (Note: you should undo when done testing to get the character back to its neutral pose.) This circle will be very helpful when shifting the body's center of mass during an animation.

    Figure 11.11. Testing the waist circle handle.

    graphics/11fig11.gif

With the legs and arms moving properly, we can now attach the skin to the skeleton. Note that you can add IK to any joint at any time, even after you've attached the skin. But we're progressing directly through character setup so we don't have to go backward to make adjustments. The hands, feet, and waist selection rings will make it easier to animate the character later.

graphics/ch11d_icon.gif


Maya 4. 5 Fundamentals
Maya 4.5 Fundamentals
ISBN: 0735713278
EAN: 2147483647
Year: 2005
Pages: 201

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net