Creating an Inverse Kinematics System


Before you can animate an inverse kinematics system, you need to build and link the system, define joints by positioning pivot points, and define any joint constraints you want.

Building and linking a system

The first step in creating an inverse kinematics system is to create and link several objects together. You can create links using the Link button on the main toolbar.

With the linked system created, position the child object's pivot point at the center of the joint between it and its parent. For example, the joint between an upper and lower arm would be at the elbow, so this is where the pivot point for the lower arm should be located.

CROSS-REF 

Chapter 10, "Grouping and Linking Objects," covers creating linked systems, and Chapter 8, "Transforming Objects-Translate, Rotate, and Scale," covers moving pivot points.

After you create the linked system and correctly position your pivot points, open the Hierarchy panel and click the IK button. Several rollouts open that let you control the IK system, including the Object Parameters rollout shown in Figure 40.1.

image from book
Figure 40.1: The IK rollouts let you control the binding of an IK system.

Selecting a terminator

Because child objects in an inverse kinematics system can cause their parents to move, moving a child could cause unwanted movements all the way up the system to the root object. For example, pulling on the little finger of a human model could actually move the head. To prevent this, you can select an object in the system to be a terminator.

A terminator is the last object in the IK system that is affected by the child's movement. Making the upper arm a terminator would prevent the finger's movement from affecting any objects above the arm.

To set a terminator, select an object and then enable the Terminator option in the Object Parameters rollout.

For Interactive IK mode, you can also enable the Auto Termination option included in the Auto Termination rollout. The Number (#) of Links Up value sets the terminator a specified number of links above the current selection.

Defining joint constraints

The next step is to define the joint constraints, which you specify in the Sliding Joints and Rotational Joints rollouts. By default, each joint has six degrees of freedom, meaning that the two objects that make up the joint can each move or rotate along the X-, Y-, or Z-axes. The axis settings for all other sliding and rotational joints are identical. Defining joint constraints enables you to constrain these motions in order to prevent unnatural motions, such as an elbow bending backward. To constrain an axis, select the object that includes the pivot point for the joint, locate in the appropriate rollout the section for the axis that you want to restrict, and deselect the Active option. If an axis's Active option is deselected, the axis is constrained. You can also limit the motion of joints by selecting the Limited option.

When the Limited option is selected, the object can move only within the bounds set by the From and To values. The Ease option causes the motion of the object to slow as it approaches either limit. The Spring Back option lets you set a rest position for the object; the object returns to this position when pulled away. The Spring Tension sets the amount of force that the object uses to resist being moved from its rest position. The Damping value sets the friction in the joint, which is the value with which the object resists any motion.

Note 

As you enter values in the From and To fields, the object moves to that value to show visually the location specified. You can also hold down the mouse on the From and To values to cause the object to move temporally to its limits. These settings are based on the current Reference Coordinate system.

Copying, pasting, and mirroring joints

Defining joint constraints can be lots of work-work that you wouldn't want to have to duplicate if you didn't have to. The Copy and Paste buttons in the Object Parameters rollout enable you to copy Sliding Joints or Rotational Joints constraints from one IK joint to another.

To use these buttons, select an IK system and click the Copy button; then select each of the joints to be constrained in a similar manner, and click the Paste button. You also have an option to mirror the joints about an axis. It is useful for duplicating an IK system for opposite arms or legs of a human or animal model.

Binding objects

When using applied IK, you need to bind an object in the IK system to a follow object. The IK joint that is bound to the follow object then follows the follow object around the scene. The bind controls are located in the Hierarchy panel under the Object Parameters rollout. To bind an object to a follow object, click the Bind button in the Object Parameters rollout and select the follow object.

In addition to binding to a follow object, IK joints can also be bound to the world for each axis by position and orientation. This causes the object to be locked in its current position so it won't move or rotate along the axis that is selected. You can also assign a Weight value. When the IK computations determine that two objects need to move in opposite directions, the solution favors the object with the largest Weight value.

The Unbind button eliminates the binding.

Understanding precedence

When Max computes an IK solution, the order in which the joints are solved determines the end result. The Precedence value (located in the Object Parameters rollout) lets you set the order in which joints are solved. To set the precedence for an object, select the object and enter a value in the Precedence value setting. Max computes the object with a higher precedence value first.

The default joint precedence for all objects is 0. This assumes that the objects farthest down the linkage move the most. The Object Parameters rollout also includes two default precedence settings. The Child to Parent button sets the precedence value for the root object to 0 and increments the precedence of each level under the root by 10. The Parent to Child button sets the opposite precedence, with the root object having a value of 0 and the precedence value of each successive object decreasing by 10.

Tutorial: Controlling a backhoe

As an example of a kinematics system, we start with a backhoe, which is a simple linkage system with tracks that can move forward, a chair housing that can rotate independently, and an arm and bucket that can rotate about a pivot. When you're finished with this tutorial, you can take the backhoe out and dig a hole for a swimming pool. I think you deserve it.

To create an inverse kinematics system for a backhoe, follow these steps:

  1. Open the image from book Backhoe.max file from the Chap 40 directory on the DVD.

  2. Open the Schematic View window with the Graph Editors image from book New Schematic View menu. Click the Connect button, and connect the tracks to the base plate, the base plate and the housing to the base cylinder, and the bucket to the arm to the housing. The connections should look like those in Figure 40.2.

    image from book
    Figure 40.2: The Schematic View window is helpful for linking hierarchies.

    CROSS-REF 

    You can learn more about the Schematic View window in Chapter 11, "Working with the Schematic View."

  3. Next, we need to define the pivots for the objects that can rotate. Select the housing, and notice that its pivot is already located in the center of the base cylinder where it should be. Then select the arm, open the Hierarchy panel, and click the Pivot button. Click the Affect Pivot Only button, and move the pivot to the center of the cylinder that connects it to the housing. Then do the same for the bucket. Click the Affect Pivot Only button again to exit pivot-editing mode.

  4. The next step is to define the joint constraints for the system. Open the Hierarchy panel, and click the IK button. In the Object Parameters rollout, select the base cylinder and enable the Terminator, Bind Position, and Bind Orientation options; doing so prevents the base cylinder from moving anywhere. In the Rotational Joint rollout, deactivate all the axes.

  5. Select the housing object, and enable the Bind Position axes and the X and Y Orientation axes. Then disable the X and Y Rotation axes. Select the arm object, enable all the Bind Position axes and the X and Z Orientation axes. Then disable the X and Z Rotational axes. Then click the Copy button for the Rotational joint type in the Object Parameters rollout, select the bucket object, and click the Paste button. This copies the joint constraints from the arm object to the bucket object.

  6. To test the system, select the Interactive IK button in the Inverse Kinematics rollout and select and move the bucket.

    As the bucket is moved, the arm rotates and the housing spins about its axis just as you'd expect.

Figure 40.3 shows the bucket moving. With the Interactive IK mode disabled, any object can be moved and/or rotated, and only the links are enforced.

image from book
Figure 40.3: The objects in this scene are part of an inverse kinematics system.




3ds Max 9 Bible
3ds Max 9 Bible
ISBN: 0470100893
EAN: 2147483647
Year: 2007
Pages: 383

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