Claudia Herbst
Associate Professor
Pratt Institute
Department of Digital Arts
Setting Up Squash & Stretch for an IK Leg
This tutorial briefly explains how to set up a leg for sqush & stretch using a stretchy IK handle.
There are several steps involved but it is well worth the effort ! Especially in character animation
where the ability to exaggerate is very important.
Before we get started, many thanks to Rob O'Neill whose instructions and explanations were most helpful!
Also, for setting up a stretchy FK rig, I recommend a tutorial found in
Inspired 3D AdvancedRigging and Deformations (p.19-22).
Please note that while I am not explicitly stating so each step along the way, I am almost always
using the "Snap" tools. The Snap to Grid and the Snap to Point tool, which also functions as a Snap
to Joint tool, are invaluable in aligning things properly.
Also, since naming conventions are so important in setting up a character, you should familiarize
yourself with the following two naming functions (if you haven't already):
Modify, "Prefix Hierarchy Names..." and "Search and Replace Names..."
Let's Get Started:
In the Side view, begin by drawing a joint chain for a leg as shown in figure 1.
As you can see, we're using two joints for the knee.

Fig. 1
In figure 1, you can see that each joint's Z axis points towards its child joint.
Depending on which settings you used when creating joints, your skeleton may
or may not display the same. To make sure the subsequent steps will work properly,
with the hip joint selected, go to the main menu, Skeleton, Orient.
Applying the options depicted in figure 2, you will notice that now it is the X-axis of each
joint that points in the direction of its child joint - this is what we want.

Fig. 2
Using the default IK handle tool settings, which will create a ikRPsolver, click the hip joint,
then the ankle joint.
Now, create a NURBS circle, which we will use as (and call) a controller.
Using the snap tool... align the controller with the IK handle.
Next, point-constrain the IK handle to the controller: to do so, select the controller, shift-select
the IK handle, go to the main menu, Constrain, Point (figure 3).

Fig. 3
Now, go to the main menu, Create, Measure Tools, Distance Tool...
using the point-snap tool, click first on the hip joint, next click on the ankle joint.
Note that two locaters have been created (figure 4), and that the distance between them
has been measured. (In my case, the distance happens to come out to an even 10.)
Maya has created a Distance node, which we will revisit shortly.

Fig. 4
First, we will Point Constrain the locators to the hip joint and controller, respectively. To do so,
select the first locator, shift-select the hip joint, go to the main menu, Constrain, Point.
Next, select the second locator, shift-select the controller, go to the main menu, Constrain, Point.
In the command line, type the following command: createNode multiplyDivide -n char_l_leg_md;
(Alternatively, you could create a multiplyDivide utility in the Hypershade and rename it...)
After the node has been created, it is still selected. Open the Attribute Editor and change the
Operation to Divide. Next, open the Connection Editor. Load the multiplyDivide node as the Inputs.
Next, open the Hypergraph. Make sure that, in the Hypergraph, under Display, Options, Shape Nodes
are checked. Select the Shape node of the Distance node. In the Connection Editor, load it
as the Outputs.
Connect the Distance attribute of the Distance Shape node to the Input1: Input1 X attribute of the
multiplyDivide node, (which is named char_l_leg_md). See figure 5.

Fig. 5
In the next step, you will add up the translationX value of the leg joints below the hip joint. To do so,
select the first knee joint; open the Attribute Editor, and write down the translation X value of that joint.
Do the same for the second knee joint, and then the ankle joint. Using a calculator, add the three
numbers. Write down the added value.
Open the multiplyDivide node (which is named char_l_leg_md) in the Attribute Editor and enter the value
you just wrote down in the Input2 field. In my case the value is 10.245. See figure 6. (A quick way to get
to the multiplyDivide node is to open the Distance node in the Attribute Editor, click the char_l_leg_md
tab, and click the "Select" tab. Or, simply type select char_l_leg_md; in the command line.)

Fig. 6
Now type the following command in the command line: createNode condition -n char_l_leg_cnd;
Open the Attribute Editor for the Condition node and set the Operation to Greater Than.
Open the Connection Editor, load the Condition node as the Inputs. Load the Distance Shape node
as the Outputs. Connect the Distance attribute to the First Term attribute of the Condition node
(which is named char_l_leg_cnd).
Open the Condition node (which is named char_l_leg_cnd) in the Attribute Editor.
Enter the combined joint translation X value from earlier (in my case that was 10.245) in the
Second Term field (see figure 7).

Fig. 7
Open the Connection Editor once more... and...
...load the multiplyDivide node (which is named char_l_leg_md) as the Outputs.
...load the Condition node (which is named char_l_leg_cnd) as the Inputs.
Connet the "Output X" attribute of the multiplyDivide node to the "Color if True R" attribute
of the Condition node (see figure 8).

Fig. 8
Now, for hte last couple of steps in the Connection Editor...
...load the Condition node into Outputs. Load each of the leg joints, except the ankle joint,
as the Inputs and connect the Out Color R attribute of the Condition node to each of the
Scale X attributes of the joints (see figure 9).

Fig. 9
Voila! Pick the controller and stretcccchhhhhhh....