| Inverse
Kinematics
Ted Boardman tedb@tbmax.com
http://www.tbmax.com
Spring
is here…right, there’s six inches of new snow
in my driveway and there’s a cold raw wind blowing off the
ocean. There were a few green shoots emerging from between the
remnants of last year’s fallen leaves just before this recent
snowfall so it seems inevitable that I’ll be sitting on the
front porch again, soon.
One
of the sure signs of spring is that tankers of asphalt for summer
paving projects are replacing the ships coming up the river loaded
with road salt. Portsmouth is an active shipping port for goods
like petroleum products, road salt, gypsum, scrap metal, fishing,
and nuclear submarines, as well as large and small yachts stopping
by on their way up the New England coast later in the spring and
summer.
I
had to put the column aside for a trip and I’m just back
from a trip to Palm Springs, CA where it reached 102 deg F, much
too hot for me even in mid-summer and, while there is no apparent
link between New England weather and that of the southern California
desert, this month’s column is going to be all about linking
in VIZ and max.
I’ll
take a look at some fundamentals of using several tools in Autodesk
VIZ and 3ds max that allow you to set up relationships between
objects in the scene that can make animations and the movement
of objects easier. There are several lessons to be taken from the
process that I’ll go through step by step to illustrate a
practical use of linking, including:
- Hierarchical
Linking
- Dummy
Helper objects
- Interactive
Inverse Kinematics
Yes,
that is a lot of big words, but their use is not so difficult
once you get the basic concepts down.
Hierarchical
Linking is
setting up a Parent-Child relationship between objects in the
scene usually to control move and rotate transformations. Transformations
of the parent object are passed to the child, while the child
may have it’s own transformations.
Complex ancestries may be created with a parent having many children
and grandchildren, etc, but a child can only have one parent.
Dummy
Helper objects are non-renderable objects that
can be included in hierarchical linking to act as control objects
or secondary pivot points.
Interactive
Inverse Kinematics allows you to set transformation
limits to objects or helpers and have them interactively update
as you transform the parent objects in the scene. Check the online
help files for more definitions of Forward and Inverse Kinematics.
In
the example in this column I will show you how to create the telescoping
pistons found in a tip body dump truck. In reality the pistons
would extend, one at a time, with hydraulic pressure to pivot the
body of the dump truck to an angle appropriate for the cargo to
slide from the body. In VIZ or max, however, you will use Inverse
Kinematics to have a control object at the end of the pistons pull
the pistons as the truck body is manually rotated.
The
scene is made up of the truck body and three nested cylinders.
Two dummy objects are in the scene to act as connection points
for the cylinders. One will be linked to the truck body to serve
as an apparent attachment point for the end cylinder; the other
dummy will be a connecting pin at the base of the bottom cylinder.
This
scene is created in Autodesk VIZ 4, but may also be opened in 3ds
max 4, 5, and 6. However, max 5 and 6 are slightly different in
the basic IK operation as will be noted in the text.
Hierarchical
Linking
Open
the VIZ 4 file called DumpTruckBody_orig.max and save it as DumpTruckBody01.max.
The
first thing to do is to analyze the action you want and to setup
the parent-child relationships. The driving object in this scenario
is the rotation of the truck body itself. The telescoping pistons
will follow the dummy linked to the truck body as it rotates
and the pistons, which are linked to each other from the top
down will remain pinned to the second dummy object, the last
parent in that hierarchical chain. Figure 1 shows the scene and
the location of the Select and Link tool in Autodesk VIZ 4.

Figure
1: Select
and Link tool in Autodesk VIZ 4 and scene setup for telescoping
pistons
The
Pivot Point locations of objects have a big effect on linking
and certainly animation and the objects have been created or
edited with that in mind. The Pivot Point locations for each
object can be seen in Figure 2. Several objects share common
pivot points.
Figure
2: Pivot Point locations for objects
The
actual linking process is a drag and release operation. You
click the Select and Link button, pick when you see the link
cursor and hold on the child object. Hold the left mouse button
and drag to the parent object. You will see a dotted “rubber
band” line
from the child’s pivot to the cursor. Release the left
mouse button when you see the new link cursor and you will see
the parent object flash white briefly to indicate the link has
taken place.
The
first link you will establish is the DumpBody object to the Top_Dummy01.
Click the Select and Link button and, in the Front viewport,
pick Top_Dummy01 and drag to DumpBody. Release when you see the
cursor indicating a valid parent object as seen in Figure 3.
Figure
3: Click Select and Link and pick and
drag from the child Top_Dummy01 to the parent DumpBody. Changing
cursors and the rubber band line are the indicators the link is
being performed. The parent flashes white when you release the
left mouse button to complete the link.
Zoom
in on the cylinders in the Front viewport and use the same Select
and Link process to link the smaller Cylinder03 to Cylinder02. Again
to link Cylinder02 to Cylinder01, and finally link Cylinder01 to
BasePin_Dummy. Click the Select button in the main toolbar to exit
the Select and Link tool. Click the Select by Name button on the
main toolbar or type H to call the Select by Name dialog. Check Display
Subtree at the bottom left to show the hierarchy as children indented
below their parents in the list. It should look just like Figure
4.
Note: if
the list is not the same and there is a Pick button instead of Select
in the dialog, you have not yet exited Select and Link mode. This
process can be used to link objects by name rather than picking them
in the viewports.
Figure
4: Checking Display Subtree in the Select
Objects dialog will indent children below the parent allowing you
to visually check the hierarchy.
Setting
Up IK Joints
You
will now learn to set up restrictions to control the amount of
sliding and rotation possible in the three cylinders of the piston.
Each should be able to slide almost their full length, but not
pull out of the larger cylinder in the system. They should not
be able to rotate in any axis and the smaller Cylinder03 should
appear to be attached to Top_Dummy01 as DumpBody rotates to dump
its load.
Note: Initial
setup of the IK joints is where there are noticeable variations
between Autodesk VIZ 4 and 3ds max 5 & 6. In 3ds max 5 & 6
you must first select Cylinder03, then go to the Animation pull-down
menu, IK Solvers, and choose HD Solver. Then pick BasePin_Dummy
as you see the dotted rubber band line attached to the cursor.
This applies a Bones system that allows adjustment of sliding
joints.
In
both VIZ and max, select Cylinder03 and, in Hierarchy panel,
IK, open the Rotational Joints rollout and clear the Active checkbox
for each axis. See Figure 5. Repeat this for Cylinder02 and Cylinder01.
For BasePin_Dummy clear the X and Z rotational axes, but leave
the Y axis Active so the dummy will rotate in that axis freely.

Figure 5: For all three cylinders clear the Active
option in the Rotational Joints rollout.
You have to do each cylinder individually and this is a good habit
to get into for general practice. Deactivating the rotational axes
will prevent wild flipping of hierarchical links while you are
trying to set a system up. You can then go back and activate them
as needed.
Cylinder01, the large base cylinder will not slide in this system.
Activate the Front viewport. Select Cylinder02 and expand the Sliding
Joints rollout in the Hierarchy panel. Check the Active and the
Limited options in the Z axis area. This allows the joint to slide,
but limits it to settings of 0 in either direction (positive or
negative Z axis).
Pick and hold on the spinners for the From: numeric field and
move the new double arrow cursor until the number is about 100.
Cylinder02 will just project slightly from Cylinder03 on the left
side as seen in the Front viewport. See Figure 6.

Figure 6: Check Active and Limited then click
and hold on the From field spinner until it reads about 100. You
will see the Cylinder02 slide interactively as you adjust the spinner.
Next, click and hold on the To: spinner and adjust it to about
190 where Cylinder02 is almost out of Cylinder01. See Figure 7.
You have just set limits for that cylinders IK sliding when in
Interactive mode.
Figure 7: Use the spinners in the To: numeric
field to set the limits for Cylinder02 to extend to.
Select Cylinder03 and, in the Hierarchy panel, check Active and
Limited in the Z Axis area and adjust only the To: field spinners
to read about 100. The actual numbers are determined by an objects
size, pivot point location, and starting position and you are controlling
relative sliding limits.
To test the sliding limits and the action of the cylinders, toggle
the Inverse Kinematics Mode Toggle (or pick the Interactive IK
button at the top of the Hierarchy panel). Select Cylinder03 and,
in the Top viewport, move the cylinder to the left. As it pulls
out of Cylinder02 it will reach a point where it pulls Cylinder02
from Cylinder01. See Figure 8. Moving Cylinder03 back collapses
the pistons into each other again. Right-click to cancel the Move
or click Undo to return the cylinders to their original position.
Figure
8: Toggling Interactive Mode on allows
you to test the restrictions you set by moving Cylinder03 in the
viewports.
The cylinders have the correct action now but there is nothing for them to
do. You will Bind Cylinder03 to the Top_Dummy object linked to DumpBody so
that it will always try to track the dummy.
With Cylinder03 selected in the Front viewport, go to Hierarchy
panel, IK, Object Parameters rollout. In the Bind to Follow Object
area, click the Bind button. In the Front viewport drag the cursor
to the Top_Dummy01 object and release the mouse when you see the
pin cursor. See Figure 9. Click the Bind button to disable it.
This tells the Pivot Point of Cylinder03 to try to stay attached
to the dummy.
Figure 9: Use the Bind option in the Hierarchy
panel, to bind the Pivot Point of the top cylinder to the dummy
object.
To test the final connection, zoom out in the Front viewport and
select the DumpBody. Now rotate the DumpBody in the Z-axis of the
Front viewport a little over 90 degrees so the body goes past vertical
and back to horizontal. The piston cylinders always try to stay
with the Top_Dummy01 and will slide accordingly. If you rotate
way past vertical you will see that the top cylinder is not actually
connected.
Making It All Work
So far, you have been able to observe the interactive process
of the linking system. When it comes to animating the scene though
you do not just turn the Animate button on and set the appropriate
keys. You must allow VIZ or max to calculate the keys.
You must turn off the Interactive IK button in Hierarchy panel,
or toggle Inverse Kinematics Mode button off. You can then turn
the Animate button on and animate the DumpBody rotating over the
100 frame default. Then, in Hierarchy panel, Inverse Kinematics
rollout, click the Apply IK button.
Now play the animation back and you will see the cylinders behave,
as you would expect for this type of system and animation.
Summary
For
IK to work correctly the position of object’s Pivot
Points is an important factor. Linking the Parent-Child relationships
in the correct order is next. It is extremely helpful to deactivate
all Rotation axes in the Hierarchy panel, IK tab. The Sliding joints
are deactivated by default.
Setting Limits, either for Sliding or Rotation Joints depending
on your needs will help control the linked system and constrain
objects in a more realistic manner. In order to see the results
of any changes to Sliding or Rotation Joints in the viewports you
must have the Interactive IK turned on and the best results are
seen by adjusting the spinners of the From and To restrictions
manually rather than entering the numbers directly.
For any animation to be correct you must disable Interactive IK
and use the Apply IK in the Hierarchy panel to actually create
the necessary keys in the Track bar.
There are a multitude of other adjustments that you can use to
fine tune the results but this should get you started with IK and
Sliding Joints.
You can open the file DumpTruckBody.max to view the results of
the steps performed here.
Good luck and have fun.
Ted
DOWNLOAD
MAX FILE (25 KB)
|