Solid knee in IK leg
The setup that is created in this tutorial differs a little bit from the IK legs that you might have been building up until now. For one thing, it does not include an inverse foot system to automate the roll for the toes or the leaning of the foot. It doesn't include a pole vector controller either. It has only the necessary attributes, with control over everyting, and at the same time overall simple to manipulate, so that the animator has a flexible setup that can work with, free of fancy stuff that in the end could prove to be counterproductive.


Start by drawing the COG joint, and the leg joint structure, in the side view. Once it's done rename the joints as shown and move the hip joint about 2 grid units in X.

Note - make sure that Auto Joint Orient is set to "none" in the joint tool options.


Orienting the bones
Orient the jHip, jKnee, jAnkle and jToes joints so that their local axis are as shown: Y pointing to their child joint, Z pointing up. You can use rig101orientJoint.mel for orienting the joints.

Tip - to toggle the local rotation axis for a selected joint, execute display > component display > local rotation axis


Create two cube controllers using rig101WireControllers.mel.

Modify them so that they look like in the image. Place the pivot for ikFootCtrl at the position of the jAnkle joint, and the pivot for ikToesCtrl at the position of the jToes joint.

Rename the controllers and freeze their transformations.


ik RP handles Create three ik RP handles : one from jHip to jAnkle called ikLeg, one from jAnkle to jToes called ikAnkle, and one from jToes to jToesEnd called ikToes.

Make sure that the "sticky" checkbox is enabled in the ik handle tool option box.


Parent the first two ik handles to ikFootCtrl. Parent the third ik handle to ikToesCtrl, and then lastly, parent this controller to the first one.


Create a locator. Name it locPV, and snap it to the jHip joint's position. Parent the locator under the jCOG joint. Select the locator, then the ikLeg ik handle, and execute Constrain > Pole Vector.


Create a float attribute called "twist" on the ikFootCtrl controller. Create a plusMinusAverage utility, and call it pmaLegTwist. Finally, create a multiplyDivide utility and call it mdLegTwist.

Tip - you can use rig101ListUtilities.mel to create utilities and quickly set up connections.


Set up the connections using the following MEL commands :
connectAttr ikFootCtrl.twist mdLegTwist.input1X;
connectAttr ikFootCtrl.ry mdLegTwist.input1Y;
connectAttr jCOG.ry mdLegTwist.input1Z;

setAttr mdLegTwist.input2X -1;
setAttr mdLegTwist.input2Y -1;
setAttr mdLegTwist.input2Z 1;

connectAttr mdLegTwist.outputX pmaLegTwist.input1D[0];
connectAttr mdLegTwist.outputY pmaLegTwist.input1D[1];
connectAttr mdLegTwist.outputZ pmaLegTwist.input1D[2];

connectAttr pmaLegTwist.output1D ikLeg.twist;


Rotation Order
Last but not least, change the rotation order of jCOG, ikFootCtrl and ikToesCtrl to xzy, and then hide the ik handles and the locator.

You can also lock and hide the translation and scale attributes for the ikToesCtrl controller, and the scale attributes for the ikFootCtrl controller.


If you study the connection network we have just created, you will see that the twist attribute on the poleVector is fed the result of adding up three values : the Y rotation of the foot controller plus the twist attribute of the foot controller, minus the Y rotation of the COG joint. This setup ensures that the knee will always be pointing in the direction of the foot controller, no matter what happens with the COG joint

Download Maya file