The assignment will walk you through rigging an object using basic rigging techniques. The goal of rigging is to provide animators with useful tools to animate with. In general, rigging deals with characters, but for simplicity we will start by rigging an inanimate object. We will be using the Pirate Ship file for this assignment as well as the Animation menu set.
Your first task is to change the pivot points for the flaps and rudder of the ship into something more useful.
Snap the pivot of each flap to the top, outer edge.
Snap the pivot of the rudder to the center of the back of it.
Snap the pivot of each cannon to the back of it.
We will only be rigging the right side of the ship, so don't bother with anything on the left side.
If you open the Outliner, you will notice that everything is named reasonably well, but lacks organization. We will fix this.
Group all of the left and right cannons into the left_cannons and right_cannons groups respectively.
Similarly, group all of the left and right flaps into the groups left_flaps and right_flaps.
Place all of the sails, masts, and beams under the sails group.
Finally, group all of these groups and the remaining objects into the ship_geo group.
Now we will start to create the controls to be used by the animators.
Use Create → NURBS Primitives → Circle to create three circles.
Place two of them encircling the bottom of the ship and one over the wheel.
Name the circle over the wheel wheel_anim, the outer circle top_con_anim, and the inner circle ship_anim.
Instead of interacting with the geometry, animators will use these curves to animate the ship.
You might be wondering why the ship has two anims. The top con is there to place the ship in its initial position in the animation. The ship anim is there to let the animator move the ship relative to its initial position. This way if we ever need to move the ship to its starting point we can simply zero out the ship_anim. As a rule of thumb, you should never animate the top con since this will make it harder to move your animation to a different scene.
Finally we will create the control for the cannons.
Switch to the side view.
Go to Create → EP Curve Tool (Options) and change the Curve degree to 1 Linear.
Use the tool and grid snapping to create a box around the cannons.
From another view, move the box to the side of the ship and name it right_cannon_anim.
Now we will tell Maya to use the current position as the defaults for the anims.
Select all of the anims you just created and go to Modify → Freeze Transformations.
Notice in the Channel Box that the Translate and Rotate for the anims is now 0 and the Scale is 1. Freeze Transformations keeps an object's current position, but sets it to be the new default position of the object. This is useful for animators since it allows them to quickly return to the default position by zeroing out the Channel Box. (Transformations have already been frozen on each piece of ship geometry.)
We created a few more objects in the last step so we must clean up the Outliner again.
Place the wheel_anim, right_cannon_anim, and ship_geo under the ship_anim.
Place the ship_anim under the top_con_anim.
Now we have single top node again.
Rigging is a process of giving animators control over an object, but is also seeks to hide details from the animator that they shouldn't be concerned with. The primary method for accomplishing this is restricting the channels, such as translate and rotate, that animators are able to key. To effectively remove an channel from the Channel box, select it then Right-click it and select Lock and Hide Selected from the menu.
If you accidently hid the wrong channel, you may be wonder where these channels went. You can find a list of all available channels by navigating to the Channel Box menu set and going to Edit → Channel Control. The channels you hid should be listed under Nonkeyable Hidden. Select them and move them to Keyable to unhide them.
Lock and Hide the following channels for each of the anims:
top_con_anim: Scale channels
ship_anim: Scale and Visibility channels
right_cannon_anim: All channels
wheel_anim: All channels
Now that we have locked away all the channels on the wheel_anim we will add our own custom attribute.
Select the wheel_anim.
In the Channel Box menu go to Edit → Add Attribute.
Set Long name to Turn, Data Type to Float, Minimum to -90, and Maximum to 90.
Click OK to add the attribute. Notice the new channel in the Channel Box.
Although we have added a new attribute to the wheel_anim, at the moment it does nothing. We will fix this momentarily using the Hypergraph. The Hypergraph represents the scene as a set of boxes, which represent objects. These boxes can be connected, which allows the attributes of one object to control the attributes of another. We will use the Hypergraph to make the Turn channel on the wheel_anim affect the rotation of the wheel and rudder.
First, go to Window → Hypergraph: Connections.
Select the wheel_anim, wheel, and rudder.
In the Hypergraph, go to Graph → Input Connections. This should display the nodes for the selected objects as well as their shape nodes, which you can ignore. Using Left-click you can arrange the boxes as you please.
To connect two nodes, Middle-click and drag on the right side of the output node and release on the input node. You can either choose a connection from the suggestions that appear, or choose a specific one by selecting Other... from the bottom of the menu.
Do this from the wheel_anim to the rudder. We want a very specific connection, so select Other... from the menu that appears. This will bring up the Connection Editor.
Select Turn from the list on the left and select rotateY on the right (This can be found under rotate, click the small + to expand). Now, Turn and rotateY should be highlighted and in italics. The Turn attribute now controls the Rotate Y of the rudder.
Repeat the same process for wheel_anim and wheel, except connect Turn to rotateZ.
Try changing the value of Turn on the wheel_anim. The wheel and rudder should rotate as you change the value. Unfortunately, there is one problem with the current configuration. The wheel should be rotating in the opposite direction.
Luckily this can be fixed relatively easily by using a Multiply Divide node.
In the Hypergraph menu go to Rendering → Create Render Node....
From the list select Multiply Divide. The node should appear somewhere in the graph. If you don't see it, try zooming out.
Connect the wheel_anim's Turn attribute to the Multiply Divide node's input1X attribute (note that the use of X in this case is arbitrary and doesn't necessarily correspond to axes).
Next, select the Multiply Divide node and in the Channel Box change the value of Input 2X to -1. This essentially takes the two input values (Turn and -1), multiplies them, and outputs the result via the nodes's outputX attribute.
The final step is to connect the outputX of the Multiply Divide node into the rotateZ of the wheel. This will replace the previous connection between the wheel_anim and wheel.
Changing the value of Turn should now yield the correct results.
We need to add controls so we can bring the cannons out and the flaps up.
Select the right_cannon_anim and add two new attributes. Call them cannons_out and flaps_up.
Both their Data Types should be Float, the Minimum 0, and the Default 0.
For cannons_out, set Maximum to 1. For flaps_up, set Maximum to 10.
We want to have the flaps come up when we change flaps_up, but if use a direct connection like we used with the wheel_anim, then all the flaps will rotate the exact same amount. We want a little more variation and so we will use Set Driven Keys instead. The general idea is that all the flaps will be down when flaps_up is 0 and they will all be up, in different ways, when flaps_up is 10.
Go to Animate → Set Driven Key → Set.... This will open the Set Driven Key dialog.
Select the right_cannon_anim and click Load Driver.
Select all of the right flap objects and then click Load Driven. Now that everything is loaded, we can specify what attributes are driving what.
In the Set Driven Key dialog, select right_cannon_anim and flaps_up for the Driver.
Select all of the flaps and then select rotateX, rotateY, and rotateZ.
Hit the Key button.
Keying the value tells Maya that a flaps_up value of 0 means that all the flaps should be down. Now we want to specify what it should be at 10.
Set flap_up to be 10 in the Channel Box.
Rotate all of the flaps so that they are up and still reasonably connected to the ship.
Hit Key again in Set Driven Key dialog and then close it.
Try changing the flaps_up channel now. The flaps should go up and down as you change it from 0 to 10.
To bring the cannons out we will use simple connections.
In the Hypergraph, connect the cannons_out attribute of the right_cannon_anim to the translateX of each cannon.
Changing cannons_out to 1 should cause all the cannons to move outward.
Your final task is to organize your rig into layers. These layers will prevent the animator from touching things they shouldn't and give them visual hints of what they are looking at.
Create four new layers by clicking the Create Layer button () in the Layer Editor.
Double-click a layer to edit it. Name and color the layers like this:
center_anims - red
left_anims - blue
right_anims - green
geometry - none
You can add objects to a layer by selecting them and then Right-clicking a layer and selecting Add Selected Objects from the menu.
Add the top_con_anim, ship_anim, and wheel_anim to the center_anims layer.
Add the right_cannon_anim to the right_anims layer.
Add ship_geo to the geometry layer.
The two boxes to the left of the layer's color indicate the current visibility and display type. You can click these boxes to toggle the current setting.
For the geometry layer, set the display type to Reference (indicated by an "R"). This will prevent the animator from accidentally selecting the geometry.
With everything in its proper place, you should be finished.