Let's now set up the legs for our character. Before doing so, it's very important to understand how legs work, and how certain basic motions are achieved, like walking, jumping, turning and pivoting.
If you stand up and walk a few steps (please do if you can), you'll notice that the walk cycle uses different pivots at different stages of each step. You start using the ankle, then the heel, then the ball, and then the toes. This requires leg setups to have several pivot points that work independently, but also as a group. This makes crucial to know not only where to place pivots, but how to link them together so that they'll work as expected. Take some time watching yourself in the mirror doing several actions, and watch carefully how your legs and feet move and act during each motion. You'll notice that this is perharps one of the most complicated areas of motion.
Ok. Now that you've got a grasp of how your leg moves let's begin.
Rigging the leg it's pretty straightforward. Just create a HI IK solver that goes from the thigh bone (Bone_thigh) to the leg's little end bone (Bone_ikterminator_leg). That's it. You can grab the goal and move it, and your leg should move properly. Remember to set the IK solver's parent space to Start Joint. Name this solver IKchain_ankle
Now, let's create the IK solvers for the feet. Select the first bone in the chain (Bone_foot), and create an HI IK solver that ends at the next bone (Bone_toes). Create a second HI IK solver from Bone_toes to Bone_ikterminator_foot. If any of the bones go whacko and become strangely rotated, adjust the IK solver's swivel angle (mines are at 0). Name these solvers IKChain_ball and IKchain_toes. Set the IKchain_ball's parent space to IK goal (this is the ONLY solver set this way). The reason for this is because if we don't do it this way, the foot will twist when rotated on the world Z axis. Let's continue.
It's time to start placing the helper objects (points and splines) that will drive the rotations of the foot. There are a lot of controls involved here, some of which I've managed to automate using custom attributes, wiring, etc.
Place two point objects. One at the ankle and one at the ball of the foot. Name them FootControl and Pivot_ankle respectively. Aligin them pivot-pivot with the following nodes:
- Bone_IKterminator_leg. (Position).
- Bone_foot. (Position and orientation).
I've changed the display attributes on mines. Select the FootControl point, and set its absolute rotation values to [0,0,0].
Now, create three rotators and two point obejcts more. Position one of the point objects EXACTLY at the heel of the foot. Name it Pivot_heel. Place the second point object at the ankle. Name it LocalRotation. Place one rotator at the ankle. Name it Rotator_foot. The next one goes at the ball, and it's named Rotator_toes. The last one goes at the pivot of the ikterminator bone of the foot. It's named Rotator_rollfoot. Align them as follows:
- Bone_toes (orientation)
- Bone_foot (position and orientation)
- Bone_foot (position and orientation
- Bone_toes (position and orientation)
- Bone_ikterminator_foot (position and orientation)
There you go. Let's start the linking process.
Prevoius point objects hidden for better viewing (above)
Ok. Link the IKchain_toes to the Rotator_toes. Link the IKchain_ankle to the Pivot_ankle. Link all three, the Rotator_toes, Pivot_ankle, and the IKchain_ball to the Rotator_rollfoot. Link the Rotator_rollfoot to the Picot_heel. Link the Pivot_heel to the LocalRotation. Link this one to the FootControl.
Select the Rotator_foot object, and link it directly to the Bone_ikterminator_leg. Then, link the Bone_foot to it. Turn off all of its inheritances, and lock the Y and Z rotation axis for it.
Everything is set. Now, here are the instructions on how to use it. First, grab the Rotator_toes and rotate it on Z (local). You'll see the toes go up or down. Very nice. You can actually lock the remaining rotation axis, since you'll only rotate it on Z. Also, lock the move axis too (all). Now, select the Rotator_foot node. Rotate it on X (local). Lock off the remaining axis. This control only 'twists' the foot. Something very important if your character does karate (yoko-geri anyone?). Now grab the Rotator_rollfoot node. Rotate it on Z (local). You'll see the whole leg move when you rotate it upwards. This is indeed nice. You get a complete foot rolling motion. This will aid a lot in the creation of walk cycles. You can also rotate it on Y (local). Grab the Pivot_ankle node and rotate it on Z (local). You'll notice it does the same thing, but it excludes the toes from the motion, leaving them locked to the ground. The Pivot_heel does the same, but at the heel point. Select now the LocalRotation node. This node controls the foot rotation on 'local' coordiunates. Rotate it and see (just lock the X axis... that one is controlled by the Rotator_foot node). You may rotate it in Z and Y. Lastly, select the FootControl noe. This one rotates the foot on 'world' coordinates (since it's aligned to the world). Rotate it. If you move it, the whole leg, foot should also move. You may notice the motion is far from perfect. There are some things we need to adjust to contiue.
First, select the two IK chains in the foot, and turn off the Use swivel angle at the IK solver properties rollout (motion panel). We don't need swivel angles for these solvers. Now, select the ControlFoot object, and add the following custom attributes to it...
Float spinner. From -5 to 10 default 0.
Float slider. From 0 to 1 default 1
Float spinner. From -360 to 360 default 0.
There we go. The Swivel Angle attribute will adjust the leg's swivel angle. A lot of people use separate objects for this. I like to use CA's whenever possible. It keeps things clean, and I can get a lot of commands in the same place.
The inherit swivel attribute will play an important role in leg-foot interaction. It will determine if the whole foot should inherit the rotation caused by adjusting the leg's swivel angle. Most of the time, you'll want this on. But there are times where you might want to move the character's knees without disturbing the feet. That's what this slider does.
And lastly, the Foot roll control will make the whole foot perform a pre-programmed progresive roll. This is a very complex motion, and we'll be controlling it from this spinner only. Let's get going.
Let's do the Foot Roll thing first. Here, we'll make use of a very powerful tool max has... reactor controllers. Reactor provide with a very powerful and procedural way of controlling motion. Basically, what they do is control any animatable attribute within an object basend on any other animatable attribute in any object. The user just sets certain conditions to be met, and the controller will update itself accordingly. You can even customize the reaction by using custom cuves to have non-uniform reactions. Way to beautiful to describe accurately... you'll need to experience it (if you've never used these controllers, I strongly suggest going into the docs and reading all there is about them, and doing the examples in your docs).
Ok. First, lets go over what the Foot Roll control will do. It'll do a motion that goes from having the foot in a pre-step pose to a finished roll just before you lift the foot.
That's why this attribute goes from -5 to 10. At -5 the foot is rotated backwards on its heel pivot. At 10 it's fully rotated forward on its toes. At 0 it remains at its neutral pose. There are some additional motions going up in between, but let's start doing it.