We have arrived at the upper body controls. For both characters, these include the clavicle, head, and neck controls.
For the clavicles, we could simply control them via an orient constraint, but this would not prove a very intuitive way of animating. Instead, we will use a constraint that we haven't used so far: the aim constraint.
Turn off the visibility on the Rig_Controls layer and make sure you can see the actual character geometry. Setting the geometry's layer to Template will allow you to see it but not edit it.
We need a new icon for the clavicle controls; this time, we will build it in Maya. Switch to the side view, and go to Create > Arc Tools > Three Point Circular Arc. We will use the default options.
With the Arc tool active, click once in front of the character's shoulder, then once just above it, and then a final time just behind it; this defines three points on the curve. You can see this process in Figure 12.60. Press Enter to complete the curve, and rename it to LeftClavicle.
Figure 12.60. Create a three-point arc.
Switch to the perspective view. Move the curve so it sits above the left shoulder (Figure 12.61, middle). When you are happy with the position, point-snap the pivot point to the actual shoulder joint (Figure 12.61, right).
Figure 12.61. Position the icon above the left shoulder.
Freeze the transforms and delete the history.
With the icon in place, connect it to the clavicle so that it will control the joint's rotation. Select the icon (LeftClavicle) first, and then add the corresponding joint (L_Clavicle) to the selection.
Go to Constrain > Aim and open the options (Figure 12.62).
Figure 12.62. Aim Constraint options
An aim constraint alters an object's orientation (the clavicle joint) to always aim at another object (the arc) along a set axis. See the sidebar "Aim Constraint Options."
Aim Constraint Options
Here are some of the more important options for setting up an aim constraint:
Aim Vector dictates which axis will point toward the target object's pivot point. The three boxes after it represent the X, Y, and Z axes. A value of 1 will fully influence the aim in that direction; however, a 1 in all three axes at the same time will give you a median position.
Up Vector is the axis you want to point upward. By default, it will try to align itself with the World Up vector, which is Y.
World Up Type alters the way the World Up vector is used and has the following options:
Scene Up will try to align itself with the current scene's Up axis.
Object Up causes the Up vector to try and aim at the origin of a specified object.
Object Rotation Up sets the World Up vector to use a specified object's rotations as a guide.
Vector makes the Up vector try to align with the World Up vector.
None uses none of the above and instead bases its orientation on whatever it was set to before you chose None.
Set the aim constraint's options as follows:
We know that X points down the bone. The first box next to Aim Vector represents the X axis; set this to 1 so we are aiming fully in that direction. Make sure the middle box (Y) and the last box (Z) are both set to 0 so these have no influence.
We also know that the Up Vector should be set to Y because the Y axis points up, so set the middle box to 1 and leave its neighboring boxes at 0.
Leave the World Up Type set to Scene Up.
Check Maintain Offset to enable it, since the joints may move slightly. With this setting turned on, they will stay in position.
Click the Apply button to apply your settings. Then set and Apply the same options for the right clavicle, except for the Up Vector's Y axis (the middle box); set this to 1 because the Y axis on this joint points down.
To finish up the clavicle controls, parent them to the Upper_Spine icon. This will keep them from drifting away from the body as it moves.
As you can see in Figure 12.63, we can now position the shoulders by translating the icons along the Y and Z axes.
Figure 12.63. The clavicles are now controlled by the two icons.
Add these icons to the Rig_Controls layer and save the scene.
We will use a simple icon to drive the neck's rotations, much as we did for the hips.
Create a NURBS circle, calling it NeckRotation.
Point-snap it to the neck joint. Then manipulate it as shown in Figure 12.64, left, so that the circle lies just above the shoulders.
Figure 12.64. Add a NURBS circle to control the neck's rotations.
When you set up the circle for Grae, you may need to alter its rotation, too, so that it follows the orientation of the neck.
Adjust the circle's pivot point so that it lies back over the neck joint.
Select the neck icon and, holding Shift, select the neck joint. Then orient-constrain them.
Parent the neck icon to the Upper_Spine icon.
The neck now has external control, meaning we don't need to edit the skeleton directly.
If you want, you can go in and adjust the CVs for the circle, curving the shape to fit the shoulders (Figure 12.64, right). This is purely for aesthetic reasons.
The final area of our main rig, the head, tends to be the most unpredictable area of animation. In this section we will discuss an easy way to gain full control over where your characters are facing, allowing the head to move freely or to lock onto objects as the character walks by.
As an alternative to the following technique for head rigging, you could just add a control similar to the one we implemented for the neck. That will let you control the head's rotations directly.
Open the Kila file you have been working on so far, which should be Kila_TorsoRig.mb. So you can concentrate on the head, turn off the visibility on the Rig_Controls layer. Import the file named Icon_Head.mb. This will be our main head control icon.
Point-snap the icon to the head joint. Then scale and rotate the icon so it's facing the same direction as Kila's head.
Move the icon out in front of the head, as shown in Figure 12.65, and freeze the transforms.
Figure 12.65. Import, scale, and position the head icon.
We are going to use an IK Single Chain solver that will enable us to position the head and lock it, so that the character can stay focused on one thing while her body does another. Go to Skeleton > IK Handle Tool. Making sure you have ikSCsolver selected in the options, and create a handle from the main Head joint to the Head_Tip joint (Figure 12.66, top). Call this handle Head_Direction.
Figure 12.66. Create an ikSCSolver for the head and parent it to the head icon.
We want the head icon to be able to control the IK handle, so parent the handle to the head icon.
Move the IK handle out so it lines up with the head icon (Figure 12.66, bottom). This makes the head's position more accurate.
Now the head joints will track the head icon; you can see this in Figure 12.67, middle. You can even use the head icon's Z rotation to tilt the head. Before we finish with this stage of the rigging, we can add another effect.
Figure 12.67. Use an aim constraint to get the head icon to stay focused on the head.
Select the head joint and then the head icon, and go to Constrain > Aim. In the constraint options, set the Aim Vector to be 1 in the Z axis (with 0 in X and Y), and set the Up Vector to be 1 in the Y axis (with 0 in X and Z).
Now when the head icon moves, not only does the head joint track its movement, but the head icon stays oriented toward the head (Figure 12.67, right). This makes it easier to control.
The first stage of the head's setup is complete. Now we need to check the head's rotation order, altering it to prevent gimbal lock. See the sidebar "Rotation Order and Gimbal Lock."
Rotation order and Gimbal Lock
Rotation order indicates which rotations get evaluated first; the default order is xyz, meaning the Z axis is evaluated first, then the Y axis, and finally the X axis. This means that when you rotate around the Z axis, the Y and X move with it; rotating around the Y axis will move the X axis; and rotating the X axis will only move itself.
Having an incorrect rotation order will result in what's known as gimbal lock. This occurs when two axes end up existing along the same plane; you can't get the third degree of rotation because it clashes with another. This can cause your objects to flip, and ultimately not move as you require.
Unless you are animating using the gimbal setting in the Rotate tool options (the default setting is Local), this phenomenon is hidden to you. Maya will maintain the 90-degree offset of rotation planes by adding rotational values to the other axes as needed. By carefully considering your character's movements in advance, you can prevent some gimbal lock problems. Setting the correct rotation order (in the Attributes Editor) is a crucial step.
Look at Figure 12.68, left; these are our current gimbal rotational axes. To make these settings available, open the Rotate tool options and set Rotate Mode to Gimbal.
Figure 12.68. Gimbal lock example
If we rotate round the Y axis, the X axis turns with it (Figure 12.68, middle), but the Z axis doesn't. This means the Z axis will eventually be in the same place as the X, resulting in gimbal lock. This happens because, by default, the Y axis is evaluated second, meaning the X axis will move with it but the z will not.
Changing the rotation order to zxy (or xzy, depending on how you wish the object to rotate) will mean the axes are evaluated correctly; as you can see in Figure 12.68, right, when the Y axis is rotated, all the other axes follow.
As our head icon moves around the head, it uses primarily the Y axis, with the X coming in a close second. We need these axes to remain intact so that we can then edit the Z axis, causing the head to tilt no matter where it is. Without correct rotation order, this would be difficult to achieve. Let's set this up now.
Select the HeadControls icon, open the Attribute Editor, and in the Transform Attributes, set Rotate Order to zxy. Make the same adjustment to the main head joint on the base skeleton. Now the head and the head icon will rotate correctly at any angle.
It's important to check other parts of your rig for areas where the rotation order may need altering, to reduce the possibility of gimbal lock.
With our head icon work done, and the rotational order adjusted, tidy the scene a little by placing the head icon in the Rig_Controls layer. Then hide the IK handle.
The base rig for Kilalimbs, body, and headis now finished, so save your scene as Kila_BaseRig.mb. Work on Grae, following the same steps until you arrive at the same stage for him, saving his scene as Grae_BaseRig.mb.