Legs are often controlled with an Inverse Kinematics constraint. Why? Because of the very nature of the IK constraint, which controls a chain by the position of its tip, rather than by its root. Our character's legs position will often be controlled by where its feet are in relation to the ground. This is a somewhat general rule: whenever a limb (arm or leg) has its control point dictated by its tip (hand or foot), you should use an IK constraint.
That's the case we'll find very often for legs, so the feet remain still on the ground while your character moves. The big issue is that there's more than one pivot point to the foot movement: your character can stand over its ankle, ball of the foot, or the tip of its toes. We need an easy way to control the leg regardless of what pivot point is used.
When the chain's control point resides on its root (such as the shoulders or hips), FK can be a good solution to achieve nice and fluid motion arcs.
005-IK-Leg.blend
. It has a leg mesh with a deformation bone chain already set up for our work, as you can see in the next screenshot:By default, all bone chains act in Forward Kinematics mode. If you rotate the D_Thigh.L bone, the whole leg will follow, as you would expect from an FK chain.
D_LowerLeg.L
bone, hold Shift, select the D_Thigh
bone and duplicate them using Shift + D. Press Esc so the duplicates remain in the same place. IK_Thigh.L
and IK_LowerLeg
. IK_Thigh.L
bone, hold Shift, select the D_Thigh.L
bone, press Ctrl + Shift + C and select the Copy Rotation constraint. Repeat the same for the lower leg bones, then move (M) both D_LowerLeg.L
and D_Thigh.L
to a disabled armature layer in order to remove the visual clutter, since we won't touch them anymore. IK_LowerLeg.L
, and extrude (E) it to the back of the foot. Name it T_Leg.L
and clear its parent relationship (Alt + P). We need this because this bone will drive the leg movement, acting as the IK target. The IK target cannot have a parent-child relationship with the constrained bone chain. The next screenshot shows the created target: T_Leg.L
bone, hold Shift, select the IK_LowerLeg.L
bone, and press Shift + I to add an IK constraint. Try moving the T_Leg.L
bone around to see the IK constraint in action. Under the Bone Constraints tab, in the Properties window, change the Chain Length slider to 2
, since we need the constraint to affect only the lower and upper leg bones.After moving the target bone, you'll see that the foot rotates too, since it's a child of the D_LowerLeg.L bone. We want it to remain still, rotating just when we want it to.
D_Foot.L
bone, and disable its Inherit Rotation property in the Properties window, under the Bone tab. In the 3D view, select the T_Leg.L
bone, hold Shift, select the D_Foot.L
bone, press Ctrl + Shift + C, and pick the Child Of constraint. Things will look messy, but don't panic: go to the Bone Constraints tab under the Properties window and click on the Set Inverse button in the constraint section. Now the foot rotation will follow the target bone instead of inheriting the lower leg properties, as you can see in the next screenshot: M_Pivot1.L, M_Pivot2.L
, and M_Pivot3.L
, located at the ankle, ball of the foot, and tips of the toes, respectively, as you can see in the next screenshot: T_Leg.L
bone, hold Shift, select the M_Pivot2.L
bone, press Ctrl + P, and choose Keep Offset to make the target bone children of the second pivot. Repeat this process, now making the ankle pivot parent of the tip of the foot one (M_Pivot3.L); and the M_Pivot3.L
parent of M_Pivot2.L
.This chain of parent relationships will result in the following: if you go back to Pose Mode, rotating the M_Pivot1.L bone will make the foot and leg rotate around the ankle; rotating the M_Pivot2.L bone will rotate them around the ball; and rotating the M_Pivot3.L bone will rotate them around the tip of the toes, as shown in the next screenshot:
Now we just need a way to control these three pivots with only one bone, and you probably noticed that when we rotate the second pivot, the toes should have remained planted on the ground. Lets do that now.
Since this is a somewhat complex transformation requiring different rotations on different bones, we'll use an Action constraint. This is very useful for when we have definite yet complex transformations, because we can "record" that transformation in a separate Action.
FootRoll
. In the first frame of this action, select all three pivot bones plus the D_Toes.L
bone and insert a keyframe (I) to define their rest rotation states. M_Pivot2.L
bone, rotate it 60 degrees left in side view (Numpad 3), holding Ctrl for precision, and press I to set a new keyframe for its rotation. Select the D_Toes.L
bone and rotate it up the same 60 degrees, so it goes back to its rest position, as seen in the following screenshot: M_Pivot3.L
bone and set a keyframe for its rotation too. Go up further 10 frames, rotate the M_Pivot3.L
bone 80 degrees to the left and insert a new keyframe for it. Rotate both the M_Pivot2.L
and the D_Toes.L
bones 60 degrees back to their original positions, so you get the foot up on its toes, as seen in the next screenshot: M_Pivot1.L
bone and rotate it 45 degrees to the right, making the foot stand over the ankle. Set another keyframe for its rotation. Remember the position keyframes: from 1 to 21 we get the action of standing up on the toes, with the intermediate position of standing over the ball first; from 31 to 41 we get the final rotation over the M_Pivot1.L
bone to stand over the ankle. We'll need these values to set up the foot roll controller. FootRoll.L
and go back to Pose Mode. FootRoll.L
bone still selected, hold Shift, select the M_Pivot1.L
bone, press Ctrl + Shift + C, and choose the Action constraint. In the Properties window, under the Bone Constraints tab, choose FootRoll under the Action field; Rotation X under Transform Channel; Start: 1, End: 21 in Action Length; Min: 0, Max: 40 in Target Range; and finally, Local Space in Convert. Repeat this process for the M_Pivot2.L, M_Pivot3.L
, and D_Toes.L
bones.If you rotate the controller up, you'll see our recorded action taking place, and the foot will stand on its toes nicely. We just need another constraint on the ankle bone, for the opposite action.
FootRoll.L
bone, hold Shift, select the M_Pivot1.L
bone, press Ctrl + Shift + C, and choose the Action constraint. In this constraint panel, choose FootRoll under the Action field; Rotation X under Transform Channel; Start: 31, End: 41 in Action Length; Min: 0, Max: -60 in Target Range; and finally, Local Space in Convert. The next screenshot shows the values for both Action constraints:It's a good practice to give names to your constraints, so that you can easily remember what they are up to. That's also valid for modifiers: It's not uncommon to have various constraints and modifiers in your mesh and bones. In the previous screenshot we have two very similar constraints, and their names help us understand what they do.
To finish our leg rig we need only two more bones: the main foot controller and the IK pole, to control the direction of the knee bending. Let's add them.
Foot.L
. Make it a parent of both FootRoll.L
and M_Pivot1.L
. P_Leg.L
and make it a child of the Foot.L
bone. IK_LowerLeg.L
bone and go to its Bone Constraints tab under the Properties window. In the IK constraint attached to it, define Armature as the value for the Pole Target field and P_Leg.L
in the Bone field which will appear. The leg will bend to the side, which is definitely not what we want. To correct this, set the Pole Angle slider to 90 degrees.Remember to disable the Deform property (Shift + W) of all bones except those with the D
prefix!
That's it! Now you can move all other bones to a disabled armature layer (M) and keep only the Foot.L, FootRoll.L
, and P_Leg.L
ones visible, since they're the only bones needed to control the leg. It's also a good idea to define custom shapes to them. The following screenshot shows the finished leg set up with only those three bones visible:
If you want to compare your results, there is a file with this complete recipe called 005-Leg-complete.blend
.
By using three helper bones to act as the foot pivots and a recorded action of the foot movement, we can use a single controller to move an IK leg based on three different points. By using a careful set of parent-children relationships, we can reduce the number of controllers of the leg to just three. It can be a bit tricky to set up, but it gives the animator a very easy and flexible rig to use.
IK arms work in a similar but much simpler way, since you don't need to create pivots nor actions: just create a bone to act as the hand controller, used as a target bone for the IK chain and to drive the rotation of the hand with a Copy Rotation constraint; and another bone to act as the pole target. That's all!
Chapter 5: Stretch those limbs!
18.117.188.138