The rig for the legs is quite similar to the arms. We need to create control feet that will help us to drive the feet, add IK connecting the control feet to the main feet, and finish them off by adding further dynamic attributedriven controls.
Because Kila's and Grae's feet are quite different, we will examine in detail the steps for creating the control feet for both characters.
Basic Control Feet for Kila
Let's start by creating the basic feet that will control Kila's legs. After these are in place, we can add controls for animating the toes and knees.
For the basic feet, we will use a modified version of a technique that has been around for as long as I can remember: creating a duplicate of the foot joints and using them to drive the main joints. This differs from the techniques we've used so far in that the controlling hierarchy is drawn in reversetoe to ball to ankle. So to move the foot, you rotate the toe, then the ball of the foot, and then the ankle joint, creating what's known as a reverse foot.
Before you get started, duplicate both the main skeletons' feet from the ankle down. Make sure that Group Under is set to World in the Duplicate options.
Place the duplicates in the Rig_Controls display layer. Then turn off visibilty for the Skeleton layer so that you can concentrate on the initial foot setup (Figure 12.30, top).
Figure 12.30. Create the joints that make up the basic control feet.
Reverse the order of the joints creating the reverse foot. This is easily done by selecting the end toe joints and going to Skeleton > Reroot Skeleton, which rearranges the order of the control foot. As you can see in Figure 12.30, bottom, the last joint becomes the first joint.
Now that you have the basic joints to create the control feet, go through them and rename each joint, starting with L_ConToe, L_ConBall, and finally L_ConAnkle. Do the same for the right foot (using a prefix of R_, of course).
Now bring in the icons; import the file Icon_Foot.mb (Figure 12.31a). Following Figure 12.31b, position the icon so it's on the outside of the left foot.
Figure 12.31. Import and position the foot icons.
You want this icon to rotate the foot from the ankle, as your own foot does, so press Insert and point-snap (press V) the pivot point up to the ankle joint (Figure 12.31c).
Create a mirrored duplicate of the foot icon, positioning it over the right ankle. Freeze the transforms, and rename the file to RightFoot (Figure 12.31d).
When we created the base joints for Kila's feet, in Chapter 11, we had to alter the rotational pivot of the ankles so that they lined up with the orientation of the foot. We will have to do something similar hereas you can see in Figure 12.32, left, the rotational axis for the foot icon does not follow the orientation of the foot joints.
Because you are working with an icon rather than a joint, you can't directly edit the rotational axis; nor can you rotate the joints of the feet, because they would no longer line up with the geometry. What you can do is alter the Y rotation of the icon so that the manipulator lines up with the foot (Figure 12.32, right).
When you have the Y rotation value for the left foot, copy it across for the right foot, turning it into a negative value.
Note that this will add some rotational values to the icon, which we don't really want. Once the character is bound, we can zero these values out, which will make her feet point directly forward.
Parent the joints to the icons. Select the L_ConAnkle joint and then the left foot icon, and press P. Then select the R_ConAnkle joint and parent it to the right foot icon.
You have the controllers now, so you need to connect them to the actual base feet. Make the base skeleton visible once more, and turn off the Rig_Controls layer, focusing in on the legs as seen in Figure 12.33, left.
Figure 12.33. Add IK to the legs.
For each leg, create an IK Rotate Plane handle from the hip joint to the ankle joint.
Again for each leg, create an IK Single Chain handle from the ankle joint to the ball joint, and another from the ball joint to the tip. You can see this in Figure 12.33, right.
Although it only controls a single joint, we add IK onto the ball and ball tip joints to help lock them down. They will then only move where the IK handles take them.
Rename these IK handles to L_AnkleIK, L_BallIK, L_ToeIK, R_AnkleIK, R_BallIK, and R_ToeIK.
We use a Rotate Plane IK Handle on the legs because we want to be able to control the direction the knees point. We will add this feature during the next section.
To make the control feet move the legs, you simply parent each IK handle to the joint over which it lies on the control feet. So parent L_AnkleIK to L_ConAnkle, L_BallIK to L_ConBall, and L_ToeIK to L_ConToe. Follow this pattern for the right leg's IK handles.
Figure 12.32. Adjust the rotation of the foot icons so they line up with the joints.
Now when you move or rotate the feet icons, the main feet and legs follow. What's more, you can adjust the position of the root and the feet will stay locked to their position.
In the traditional reverse foot setup, you would also have a heel joint to use as reference for the actual heel of the character. We don't need this joint here because, when the character gets animated, you will have the actual geometry to refer to.
Additional Foot Controls for Kila
Being able to manipulate the feet is one thing, but we still have the knee position to consider. We can set up the knees in much the same way we did with the elbow, by using a pole vector constraint.
First we need some icons. To help indicate that these are for joint positions, we will use the same cubes that we used for the elbows earlier in this chapter.
Create two duplicates of the elbow cubes, and point-snap them to the knees as illustrated in Figure 12.34. Rename them to L_KneePos and R_KneePos.
Figure 12.34. Duplicate the elbow cubes and point-snap them to the knees.
Ideally, we need these knee controls to exist in front of the knees, but if we add a pole vector constraint it may adjust the knee positions slightly. We don't want this to occur until this character is bound to the mesh, so to keep the joints in position we will leave the icons over the knees.
Select the L_KneePos cube and, holding Shift, select the L_AnkleIK IK handle. Then go to Constrain > Pole Vector.
Do the same on the opposite leg, selecting R_KneePos and R_AnkleIK before applying the pole vector constraint.
The knees are now locked to the control cubes and will point toward them no matter where you position the cubes. Once the character is bound, we can put the cubes in a more suitable position.
Our next task is to add controls to the toes, making it easier to pose the feet. To begin, we need some dynamic attributes added to the foot icons; when connected, these will drive the toe and foot animation.
Select both the foot icons and go to Modify > Add Attribute. The default options are set just as we want them to be, so simply type in the names for each attribute and click Add. Call these Ball Rotate, Toe_Rotate, Tip_Toe, and Foot_Twist.
Now we will use Maya's Connection Editor to wire the attributes up. This tool directly connects one attribute to another; for example, our Ball_Rotate attribute will connect to the L_ConBall's rotate Z attribute. Then when we adjust the Ball_Rotate attribute's value, the actual joint will rotate for us even though we are not directly rotating it.
Open the Connection Editor window (Figure 12.35) by going to Window > General Editors > Connection Editor.
Figure 12.35. The Connection Editor window
Open the Left Display and Right Display menus and make sure Show Non-Keyable is turned off for both. This will hide the attributes not relevant at this time, so the columns will be easier to read.
Select the LeftFoot icon and click the Reload Left button in the Editor. The keyable attributes belonging to the icon appear in the Outputs column (Figure 12.36a).
Figure 12.36. Connecting the LeftFoot's Ball_Rotate attribute to L_ConBall's Z rotation
Select the L_ConBall joint and click Reload Right. All the related keyable attributes load into the Inputs column (Figure 12.36b).
Select the attribute Ball_Rotate in the Outputs column. The attributes to which it can connect in the Inputs column turn bold (Figure 12.36c).
In the Inputs column, open the Rotate menu by clicking on the + icon next to it, and select Rotate Z (Figure 12.36d). By simply selecting the two attributes, you have connected them, and their names turn italic to confirm the connection.
Now, as you can see in Figure 12.37, the LeftFoot's Ball_Rotate attribute will drive the L_ConBall's Rotate Z attribute.
Figure 12.37. The LeftFoot's Ball_Rotate now rotates the L_ConBall joint.
Let's wire up the next attribute, Toe_Rotate. We want the toe joint to be able to rotate up and down, but right now it is tied to the position of the L_ToeIK IK handle. With that in mind, we could make the IK handle move, which in turn will move the toe joint.
First we need the toe joint's pivot to be in the same position as the L_ConBall joint so that it gives us the rotation we need: the ability to tap the toe. As it is, though, the IK handle stays locked to its pivot, causing the toe joint to point out to the side (Figure 12.38, right). To get around this, we will place the IK handle into a group; we can then adjust the group's pivot and connect its rotation to the Toe_Rotate attribute. This will then rotate the IK handle.
Select the L_ToeIK handle and group it to itself (Ctrl+G/Cmd+G). Rename the new group L_ToeRotate.
Edit L_ToeRotate's pivot point, snapping it to L_ConBall.
Using the Connection Editor, connect the Toe_Rotate attribute on the LeftFoot icon to the Rotate Z of L_ToeRotate (Figure 12.39). Now when you adjust the Toe_Rotate attribute, the toe will "tap"rotate up and down (Figure 12.40).
Figure 12.39. Connecting Toe_Rotate on the LeftFoot icon to the Rotate Z of L_ToeRotate
Figure 12.40. The Toe_Rotate in action
Notice that the joints on the control foot do not move. This is not a problem, though; all we will see when the character is completed is the actual geometry moving.
Next is the Tip_Toe attribute. This is quite easily set up; all you need to do is use the Connection Editor to connect it to the Z rotation on the L_ConToe joint (Figure 12.41). You can see this connection working in Figure 12.42.
Figure 12.41. Connect the Tip_Toe attribute to the Rotate Z of L_ConToe.
Figure 12.42. Adjusting the Tip_Toe attribute will make the character stand on her toes.
Figure 12.38. Moving the IK handle's pivot makes the toe stick out to the side.
The final attribute to connect is the Foot_Twist. This will cause the whole foot to rotate around the ball joint. We have the same issue here that we had with the Toe_Rotate attribute: If we connect to the Y rotation of the L_ConBall joint, only the back of the foot but not the front will rotate. This makes the foot take an unnatural bend (Figure 12.43, right). So, as we did with the Toe_Rotate attribute, we will use a group node to solve the problem.
Select the L_ConToe joint and group it to itself (Ctrl+G/Cmd+G). Rename the group L_FootTwist; then edit its pivot, snapping it to the L_ConBall joint.
Now you can connect the Foot_Twist attribute on the LeftFoot icon to the L_FootTwist group's Y rotation (Figure 12.44). You now have the ability to rotate the foot around the ball joint (Figure 12.45, right).
Figure 12.44. Connect the Foot_Twist attribute to the Y rotation of the new L_FootTwist group.
Figure 12.45. The Foot_Twist attribute now rotates the foot around its ball joint.
Figure 12.43. Rotating the ball joint around the Y axis gives unwanted results.
The left foot is now set up, and we can do more with it than just the standard translation and rotation. Repeat the process, adding new attributes and connecting them up to the joints for the right foot. Remember to use the group nodes to help you achieve those tricky controls.
Next up is adding the ability to turn the IK off, so that you can animate using FK. To accomplish this, we'll follow the exact same procedure that we used earlier with the arms.
Select the LeftFoot icon. Holding Shift, add L_AnkleIK, L_BallIK, and L_ToeIK to the selection.
Go to Animate > IK/FK Keys > Connect to IK/FK.
Now, using Animate > IK/FK Keys > Enable IK Solver, you can toggle the state of the IK on the feet, turning it on and off.
Apply this same IK arrangement to the right foot.
We don't need the control feet and IK handles visible anymore because all the controls are tied into the feet icons, so select the L_FootTwist and R_FootTwist groups and hide them. This hides the objects within (Figure 12.46).
Figure 12.46. The rigged legs and feet
Kila's legs and feet are now completely rigged. Save the file as Kila_LegRig.mb, and let's move on to Grae.
Basic Control Feet for Grae
Because Grae's legs will animate differently, the way we rig them is quite different from the process for Kila. We don't use a reverse foot in this instance because we don't need the ability to rotate Grae's ball or toe joints (that's not to say that using a reverse foot is the only way to achieve this). Instead, for Grae we will rely solely on the control icon.
Open the Grae_ArmRig.mb file, and import the Icon_Foot.mb file into the scene.
Using the geometry as a guide, position the icon next to the left foot, making sure it's scaled appropriately. Then freeze the transforms and rename it to LeftFoot.
Snap the pivot to the ankle joint on the skeleton (Figure 12.47).
Figure 12.47. Point-snap the icon's pivot to the ankle joint.
Create an IK Rotate Plane handle from the hip joint to the ankle joint, calling it L_AnkleIK.
Create an IK Single Chain handle going from the ankle joint to the one immediately after it, the ball of the toes. Rename this one to L_BallIK.
To help lock down the toes, create a second IK Single Chain handle going from the ball of the toes back to the first joint of the middle toe. Rename this to L_ToeIK.
You can see all of the IK handles applied in Figure 12.48.
Figure 12.48. Create three IK handles.
If Grae is lifted off the ground, leaving the foot behind will allow his toes to drag realistically and not be locked to the position of the ankle joint. This will help give the toes more weight.
Finish up by parenting the three IK handles to the foot icon.
You can now fully manipulate the rotation and translation of Grae's foot via the icon. We can move ahead now to the additional attributes needed for his feet and toes, before you apply the same techniques to create the rig for his right foot.
Additional Foot Controls for Grae
Simply moving the foot around in space isn't enough; we need to free up the toes and ankle. Enabling them to be animated individually will give the creature more life. As we've done before, we'll begin by adding attributes to the foot icon.
Select the left foot icon, and go to Modify > Add Attribute to open the Add Attribute dialog box.
Create six Float attributes called Ball_Rotate, Ankle_Tilt, Foot_Twist, L_Toe_Rotate, M_Toe_Rotate, and R_Toe_Rotate.
Connect the Toe_Rotate attributes to the actual toes, using the Connection Editor (Window > General Editors > Connection Editor).
Select the foot icon and click Reload Left (Figure 12.49, left). Then select the outer toe joint and click Reload Right.
Figure 12.49. Connect LeftFoot's L_Toe_Rotate attribute to L_OuterToe's RotateX attribute.
Highlight L_Toe_Rotate in the Outputs list, and then Rotate X in the Inputs section, connecting these attributes (Figure 12.49, right).
Repeat steps 3 through 5 of this procedure, this time connecting the M_Toe_Rotate attribute to the middle toe's rotate X attribute, and finally R_Toe_Rotate to the inner toe's attribute.
As you can see in Figure 12.50, you can now animate the toes individually and independently of the foot, simply by using the attributes on the foot icon.
Figure 12.50. The toes now animate independently of the foot.
As we did with Kila's Foot_Twist and Toe_Rotate attributes, we now need to create extra group nodes on top of the L_AnkleIK and L_BallIK IK handles. The joints they are connected to are currently locked; by creating these extra groups, we can indirectly animate the joints.
Group L_AnkleIK to itself, and rename the group to L_AnkleTilt. Snap the group's pivot to the L_Toes joint (Figure 12.51).
Figure 12.51. Snap L_AnkleTilt's pivot to the L_Toes joint.
Group L_ToeIK to itself, and rename the group to L_BallRotate. Snap this group's pivot to the same joint as the L_AnkleTilt group.
For the final group, select and group L_AnkleTilt, L_BallRotate, and the last IK handle that hasn't been grouped yet, L_BallIK. Name the group L_FootTwist. Again, snap the group's pivot to the same joint as the previous two groups.
Now that we have these control groups in place, we can connect them to the appropriate attributes on the foot icon. Using the Connection Editor:
Connect the LeftFoot's Ball_Rotate attribute to the L_BallRotate's Rotate X attribute (Figure 12.52, left).
Figure 12.52. Connect the remaining attributes to their corresponding groups.
Connect the Ankle_Tilt attribute to L_AnkleTilt's Rotate X (Figure 12.52, middle).
Connect the Foot_Twist attribute to L_FootTwist's Rotate Y attribute (Figure 12.52, right).
We now have complete control over Grae's foot. One last thing to do is lock down the orientation of his leg using a pole vector constraint.
Duplicate the cube you used on Grae's left elbow, and snap it to the left-rear knee joint (Figure 12.53). Freeze the transforms and rename this to L_KneePos.
Figure 12.53. Snap the cube to Grae's left-rear knee joint.
Select the cube (L_KneePos) and, holding Shift, select the L_AnkleIK IK handle.
Go to Constrain > Pole Vector to restrict the knee's movement. Now the rear knee joint will always point toward the cube.
As with Kila, we also want the ability to free Grae's feet from their IK constraints and animate them using FK.
Select the LeftFoot icon. Holding Shift, add L_AnkleIK, L_BallIK, and L_ToeIK to the selection.
Go to Animate > IK/FK Keys > Connect to IK/FK.
Using the Enable IK Solver tool in the same Animate > IK/FK Keys menu, you are now free to toggle the state of the IK on the foot.
To finalize the left foot, clean things up a bit. Place both icons into the Rig_Controls layer. Since we no longer need the IK handles, turn off the L_FootTwist's visibility, which will hide all the IK handles parented under it.
Now repeat the procedures for creating the basic control foot and adding its dynamic attributes to rig Grae's right foot. Then save the scene as Grae_LegRig.mb.