Lesson 12 Inverse Kinematics

Posted on Posted in AutoDesk Maya, Foundation 2008, Tutorials

IK Handles

You will learn about Single Chain IK and Rotate Plane IK.  The difference: Single Chain IK handle’s end effector tries to reach the position and orientation of it’s IK handle. Rotate Plane IK handle’s end effector only tries to reach the position of it’s IK handle.

Single Chain IK

A single Chain IK handle uses the single chain solver to calculate the rotations of all the joints in the IK chain. The overall orientation of the joint chain is calculated by the single chain solver.

  1. Open the last assignment.
    • – Open 031512_11-blendShapes_03.ma
  2. Joint Rotation Limits
    • For better results using IKs, it’s recommended that  you remove all rotation limits on joints part of the IK handle. Limiting joint rotations will prevent the IK solver from finding good joint rotations and cause the joint to behave unexpectedly.
    • – Remove all the rotation limits of the legs and arms.
    • Note: Rotation Limits and degrees of freedom are useful on joints animated manually.
  3. Single Chain IK
    • – Select ANIMATION || Skeleton > IK Handle Tool >
      • IK Handle Tool Options Window:
      • Current Solver: IKSCsolver;
      • – Click [CLOSE];
    • – On the stage, select the lShoulder bone
    • (Notice: The Joint will be highlighted. This is the start joint)
    • – Click on the lWrist  bone.
    • (Note: The IK handle is created, starting at the shoulder and going down to the wrist)
    •  
    • HYPERGRAPH: You can see the end effector connected to the hierarchy and the IK handle to the side. The end effector and the IK handle are connected, along with the appropriate joints at the dependency node level. When you control the handle, you control the whole chain.
  4. Experiment With the IK Handle.
    • – Bring up the translate Tool: Press w;
    • – Translate the IK Handle and notice the result of the bending arm.
    • Note: If the IK Handle doesn’t bend the arm or it bends it the wrong way, delete the IK handle and bend the arm appropriately and then recreate the IK Handle. If the IK handle isn’t affecting the model, Check to make sure the “envelope” in the Channel Box > skinCluster > for the model is set to 1.
    • – Activate the rotate tool: Press “e”
    • – Rotate the IK handle and notice the resulting arm bend. You will effect the bending solution, but not effect the wrist’s rotation.
    • – Rename the IK Handle o lArmIk.
  5. Preferred Angle
    • – With the IK Handle selected, RMB in the stage over the IK and select Assume Preferred Angle.
    • – The arm joints will move back to the preferred angle.
  6. Right Arm IK
    • – Create another IK Handle for the right arm and rename it rArmIk.
    • Notice: IK Handles have a higher selection.

Rotate Plane IK

A rotate plane IK uses the rotate plane solver to calculate the rotations of all joints in it’s IK chain, but not the joint chain’s overall orientation. So in our model, it calculates the rotations of the joint’s in the IK handle of the arm. So instead of the IK solver calculating the orientation of the arm, the IK rotate plane does so by a pole vector and twist disk.

(Note: The twist disk is a visual representation defining the chain’s overall representation.)

  1. Rotate Plane IK
    • – Select the IK Handle Tool Options: ANIMATION || Skeleton > IK Handle Tool >
      • IK Handle Tool Options:
      • Current Solver: ikRPsolver;
      • Sticky: checked;
      • (this option snaps the IK to it’s effector at all time);
      • – Click [CLOSE]
    • – In the viewport, click on the lHip bone then click on the lAnkle bone.
  2. Experiment with the IK Handle
    • – One big differentiating feature of this IK handle is the ability to control twist and pole vector attributes.
    • – Move the IK handle up
    • Show the IK handle manipulators: Press “t”
    • – Move the pole vector manipulator that is next to the twist disk.
    • (This manipulator affects the pointing direction of the chain)
    • – Exit the manipulator by pressing “q” and highlight the Twist attribute in the Channel Box for the IK Rotate Plane.
    • – MMB + DRAG in the stage to see the leg twist back and forth.
    • (This attribute overrides the pole vector attributes, affecting the pointing direction of the IK chain)
    • – Rename the IK rLeglk.
    • – Save 031912_12-inverseKinematics_01.ma

Reverse Foot

When you animate a character’ walking, you need one of the feet to be planted on the ground while the other foot is lifted off the ground. The time the foot is planted on the ground, The foot will roll from the heel to the toe. A reverse foot skeleton is ideal for this action.

  1. Draw The Reverse Foot Skeleton
    • – Change the stage to four view layout.
    • – Zoom into the foot in all view: Select joint + Press SHFT + “f”.
    • – Select the joint tool: ANIMATION || Skeleton > Joint Tool.
    • (Orientation should be XYZ)
    • – In the side view, create the first joint at the edge of the foot geometry.
    • – In the front view, MMB + DRAG the joint to line up with the foot.
    • – In the perspective view, turn off the geometry view: STAGE || Show > Polygons : uncheck.
    • HOLD V: to enable snap to point. Draw the three other bones snapping them to first the toesEnd, 2nd toes, 3rd ankle.
    • – Name the joints to the following:

Set up the Reverse Foot

Constrain the IK handle, ankle and toe joints to the reverse foot chain to use it.

  1. Point Constrain the IK handle.
    • – Select the ankleControl joint on the reverse foot chain.
    • – SHFT+SELECT the IK Handle you created.
    • (Note: Use the Hypergraph to help you select the joint).
    • – Select  ANIMATION || Constrain > Point.
    • (Point constraint forces an object to follow the position of the source object. The IK handle is positioned over the reverse foot’s ankleControl joint.)
  2. Test the reverse Foot Chain
    • – Select the heelControl joint.
    • – Translate the joint to test.
    • (Notice: The ankle moves with the reverse foot chain, but the other foot joints stay put.)
    • – undo your moves.
  3. Orient Constrain The Toes
    • Align the rest of the foot by orient constrain  the toes’ joint to the reverse foot.
    • – Select the toeControl joint on the reverse foot chain.
    • – SHFT + SELECT the toes’ joint. Not the toesEnd.
    • – Select  ANIMATION || Constrain > Orient > □ .

      • Orient Options:
      • Maintain Offset: ON;
      • (forces the constrained object to keep it’s position)
      • – Click [ADD];
      • (Orient forces an object to follow the rotation of an object.)
      • Note: differences of options from the images below:
      • (before Orient Constrain) When you move the heelControl, the toes move up and the rotation of the toes joint is thrown off.
      • (Orient Constrain Applied with Maintain Offset checked) When you move the heelControl again, the toes joint keeps the same orientation as the toesControl. In other words, the rotation of the toes joint stays the same as the toeControl wherever you move the heelControl.

      • (Orient Constrain Applied with Maintain Offset unchecked) The toes joint flips back to it’s own rotation. Maintain offset, takes existing rotation of the toes joint.
    • – Move the heelControl to test
    • – Undo your moves.
  4. Orient Constrain the ankle joint.
    • Repeat the last steps for the ankle joint.
    • – Select ballControl on the reverse foot chain.
    • – SHFT + SELECT the ankle joint from the leg chain.
    • – Select  ANIMATION || Constrain > Orient > □ .
    • (Note: foot joints are now aligned to the reverse foot chain.)
  5. Test The movement of the reverse foot chain.
    • – Rotate the different joints of the reverse foot chain setup

Creating the Heel-to-toe Motion

After creating the reverse foot chain, you can control the rotation of the foot by rotating various control joints on the reverse foot chain. Instead of rotating several joints to get the heel-toe-motion, use Set Driven Key to control the roll using a single attribute on the heelControl joint.

  1. Add a Roll Attribute
    • Add an attribute to heelControl named roll  that will appear in the Channel Box when you select heelControl.
    • – Select the heelControl joint.
    • – Select ANY || Modify > Add Attribute.

      • Add Attribute window:
      • Long Name: roll;
      • Data Type: Float;
      • Minimum: -5;
      • Maximum: 10;
      • Default: 0;
      • – Click [OK]
      • (Note: You can now see this attribute in the Channel Box for the heelControl);
  2. Prepare the Set Driven Key Window
    • Add functionality to your attribute by linking it up. Set the Driver, which will control the actions. In this case, it’s the heelControl’s “roll” attribute we just created.
    • – Select ANIMATION || Animate > Set Driven Key > Set
      • Set Driven Key Window:
      • – Select the heelControl joint and click [LOAD DRIVER];
      • Driver Section: highlight roll attribute;
      • (While this is highlighted in the Driver section load the objects that the driver will affect in the Driven section)
      • – Select the heelControl, ballControl,and toeControl joints and click [LOAD DRIVEN];
  3. Key The Heel Rotation
    • (Define the attributes the Driver will affect)
    • – Set Driven Key Window Continued:
      • – In the Driven section highlight heelControl and rotateZ.
      • – Click [KEY]
      • (This sets the starting rotation at 0)
      • (Note: Channel Window rotation Z is highlighted and roll attribute is at 0.)
      • – In the Channel Box, set the roll attribute to -5. This is the minimum you set earlier when creating your attribute)
      • – Set the Rotate Z attribute to 20;
      • – Click [KEY].
      • – You can now test the roll.
      • – When you are done set the roll, back to 0;
  4. Key the Ball Rotation
    • – In the Driven section, click on ballControl and then on Rotate Z.
    • – Click on [KEY] to set the starting rotation.
    • – Click on heelControl in the Driver section and set roll value to 10.
    • – Click on ballControl and set the Rotate Z to 30.
  5. Key The Toe Rotation
    • – In the Driven section: click on toeControl and then on rotateZ.
    • – Click [KEY].
    • – Click on the heelControl and set the roll value to 10.
    • – Click on toeControl and set the rotateZ to 30.
    • – Click [KEY].
  6. Test the Foot Roll
    • – Select heelControl.
    • – Click on roll attribute.
    • – MMB + DRAG on the stage to view the influence on the foot.
  7. Test the Setup
    • – Select pelvis joint.
    • – Translate and rotate the pelvis joint and see the effects of the constrained IK handles.
  8. Save your work
    • – 032612_12-inverseKinematics_02.ma

Hand Setup

Create a basic hand setup to control the hand rotations.

  1. Change the Arm IK type
    • – Select the two arm IK handles and delete them.
    • – Press Delete.
    • – Select ANIMATION || Skeleton > IK Handle Tool
    • (Set IK type to ikRPsolver).
    • – Create IK handles for both arms.
    • – Rename the IK handles.
  2. Create a Hand Manipulator
    • – Select STAGE || Show > NURBs Surfaces to show all  the NURBS on the stage.
    • – Select ANIMATION || Create > NURBS Primitives > Circle.
    • – Rename the circle lHandManip.
    • – Activate the translate tool: Press w.
    • – Hold “v” and snap circle to lWrist of the skeleton.
    • – Rotate and scale the circle to fit the wrist.
    • – Select GENERAL || Modify > Freeze Transformations
  3. Constrain the IK Handle
    • – Circle selected, SHFT + SELECT the lArmIk handle.
    • – Select ANIMATION || Constrain > Parent;
    • (Parent constraint forces the constrained object to follow a source just as if it were parented to it).
  4. Constrain the Wrist
    • – Select the circle, SHFT + SELECT the lWrist joint.
    • – Select ANIMATION || Constrain > Orient
  5. Test the Wrist Manipulator
    • – Move and rotate the lHandManip to see how it affects the arm and hand.
    • – Then Move the pelvis and see thats influence.
    • – Undo.
  6. Create a Pole Vector Constraint
    • – Create ANIMATION || Create > Locator
    • – Hold “v” to snap to point. Snap locator to lElbow joint.
    • – Move the locator back on the Zaxis by about 5 units.
    • locator select, SHFT + SELECT the lArmIk handle.
    • – Select ANIMATION || Constrain> Pole Vector.
    • (Pole vector constraint connects the “locator’s” position to the IK handles “Pole Vector” attribute. You will be able to control the rotation of the arm using a visual indicator).
    • – Rename the locator to lArmPv 
  7. Right Hand Manipulator
    • – Create the same manipulator to the right hand.
  8. Save.
    • -032812_12-inverseKinematics_02.ma