Elastic Foot using Expressions
Cartoon animation looks great with some squash and stretch. To be able to 'stretch' bones you need a set-up that can handle 'elasticity'.

This tutorial shows how to build an elastic foot using expressions. You need a fair knowledge of Maya and how to work with the hypergraph

   

Bones
Create the REAL bones using the grid.

hipREAL->kneeREAL->ankleREAL
in position (0,9 - 2,5 - 0,1) relative to the grid.

   

IK and ELASTIC Bones
Create IK bones by duplicating the REAL ones.

hipIK->kneeIK->ankleIK

Create the ELASTIC bones using the grid.

hipELASTIC->kneeELASTIC-> ankleELASTIC
in position (0,9 - 0,5 - 0,1)

Create an ikRPsolver form hipIK to anleIK
Name the IK handle:
ikHandle

   

More Bones Create the REAL foot

ankle2REAL->ballREAL->toeREAL

The ankle2REAL is used for skinning purposes so that the foot doesn't stretch when it's in elastic mode. That's why it should be close to the ankleREAL.

Parent ankle2REAL to ankleREAL to connect the foot to the leg.

   

Locators Create a locator and place it on the same position as the hips (0,9).

locatorHip

Create another locator and place it on the same position as the ankle (0,1).

locatorAnkle

   

Constrain
Point constrain all the hips to locatorHip.
Point constrain ankleREAL, ankleELASTIC and ikHandle to locatorAnkle.
Point constrain kneeREAL to both kneeIK and kneeELASTIC.
Point constrain kneeELASTIC to both hipLocator and ankleLocator. (this way the kneeELASTIC will always be half way between the locators)
Orient constrain hipREAL to hipIK and kneeREAL to kneeIK

   

Reverse Foot Lock Create a reverse foot lock. (see Reverse Foot Lock tutorial)

Compensate by creating an additional ankle2RF for the extra ankle joint.

   

Measure Distance
Create a distance tool.

Point constrain locator1 (from the distance tool) to hipLocator and locator2 to ankleLocator.

Because we used the grid to create the bones, the distance tool show measure 8 units.
When the knee is straight, the distance will be 9 units long.

   

Expression
If the distance between the hipLocator and ankleLocator is less than 9, then the IK leg should be driving the REAL leg, otherwise the ELASTIC leg should be driving the REAL leg.

For this we need an expression:
if (distanceDimensionShape1.distance <= 9) {
   kneeREAL_pointConstraint1.kneeIKW0 = 1;
   kneeREAL_pointConstraint1.kneeELASTICW1 = 0;
} else {
   kneeREAL_pointConstraint1.kneeIKW0 = 0;
   kneeREAL_pointConstraint1.kneeELASTICW1 = 1;
}

   

Done
What's left to do is just clean the hypergraph so that everything is nice and tiddy.

Now, grab the Reverse Foot Lock and move the foot around.

   

Download Maya file

Download tutorial