Rocking Objects
While setting up the scenario for my short-short film called The Message,
I found myself in need of a way to get the letter "Y" to rock on its
lower side edges. A little experimenting in A:M version 8 led to the creation
of a simple three-bone rig, connected via a series of constraints, that allowed
me to rock the letter from side to side. If I'd wanted to rock the object on
all four of its lower edges, I would have had to add a separate control for the
extra sides, which would have proved a bit cumbersome to operate. With the
addition of relationships to A:M version 9, though, rocking on all four edges
can be accomplished very easily with a single control.
Planning
The design of the rig is simple. There are four nulls, one placed at each of
the lower side edges of the object. They're parented in a simple chain, and
each rocks one side of the object. Because of the parenting relationship, the
end null in the chain moves when any side is rocked. The model itself then
becomes a child of this fourth null so that it goes along for the ride.
Therefore, prior to adding the rig, there needs to be a bone at the base of the
model hierarchy that either directly manipulates all the model's CPs, or acts
as a parent for other bones or nulls that control individual parts of the
model; i.e., a bone that turns a spinning seat on a four-legged stool. To
finish off the rig, a fifth null outside the hierarcny will act as the control
for the rig, driving the rocking motion via a couple of relationships driven by
its position.

Create/load your model
For the purpose of this tutorial, I'm going to use a simple cube measuring
20cm on each side, but anything with a square or rectangular base will do.
Whatever you use, make sure that the lower edge of your model is sitting on the
X-Z plane (level with 0 on the Y axis). This is a good habit to get into when
modeling things that will be sitting on the ground or floor.
Once you have created (or loaded) the model, enter Bones mode by clicking
the Bone button on the Mode toolbar, or by pressing F6 on your keyboard. Add a
new bone somewhere in the middle of the model. Its exact position and
orientation aren't important, as it will simply serve to move the entire model.
If you already have other bones or nulls in your model, make all of them a
child of this new bone in the Project Workspace by dragging them on top of it.
If this is the only bone in the model, group the entire model to assign all CPs
to that bone. In either case, select the bone in the Project Workspace and
rename it as "ModelBase".
Build the rig
Add the following nulls in order, making sure to name, position, and
establish the hierarchy placement of each null before moving on to the next
one. Some simple names are suggested, but feel free to change them. Just be
careful not to get confused when we start setting up the workings of the rig
later on.

Null 1: rLeft
Purpose - This null will be at the model's left-most point
of contact with the ground, and will rock it to the left.
Position - In the Front view, right-click (Command-click on
a Mac) in the model window and select [New][Null]. Rename the null to
"rLeft," and move it into alignment with the spline representing the
lower-left edge of the model. Because the null's default position is at the
origin, this is most easily accomplished by selecting the null in the model
window and using the left cursor key (occasionally combined with the SHIFT key
for larger steps) to move it into position.

Null 2: rRight
Purpose - This null will be at the model's right-most point
of contact with the ground, and will be the child of the rLeft null.
Position - Right-click (or Command-click on a Mac) in the
viewport select [New][Null], change the name to "rRight," and drag it
onto rLeft in the PWS to make it the child. Select the null in the model window
and move it into position on the lower-right edge of the model.

Null 3: rFront
Purpose - This null will be at the model's front-most point
of contact with the ground, and will be the child of the rRight null.
Position - Right-click (or Command-click on a Mac) in the
viewport select [New][Null], change the name to "rFront," and drag it
onto rRight in the PWS to make it the child. In the Top view, select the null
and use the cursor-down key to move the null into position at the front edge of
the model (near the bottom of your window).

Null 4: rBack
Purpose - This null will be at the model's back-most point
of contact with the ground, and will be the child of the rFront null and the
parent of the ModelBase bone.
Position - Right-click (or Command-click on a Mac) in the
viewport select [New][Null], change the name to "rBack," and drag it
onto rFront to make it the child. In the Top view, select the null and move it
into position on the back edge of the model (near the top of your window).
Select the ModelBase bone and drag it onto rBack so that ModelBase becomes its
child.

Null 5: Rock
Purpose - This will be the null used to operate the rig.
Position - Right-click (or Command-click on a Mac) in the
viewport select [New][Null]. Rename it as "Rock" and move the null
straight up in the Front view, stopping just above the model.

When you're done, the hierarchy in the Bones folder should look like the
sample on the right. If not, adjust things in the Project Workspace as
necessary.
Relationships
In the Project Workspace, open the rollout for the Rock null, then the
rollout for its Transform properties, and finally the rollout for its Translate
properties. Right-click (Command-click on a Mac) on the X property and select
[New Relationship]. This will set the X-Translate channel as the driver, or
controller, of the relationship. For this relationship, we're going to control
the rLeft and rRight nulls with the X position of the Rock null.

Select Rock and move it to the left (negative) on the X axis, either by
changing the X-Translate value directly in its properties, or by using the
Translate tool (keyboard shortcut: n) and limiting movement to only the X axis
as you drag it. The exact amount is up to you, but keep in mind that the
farther from zero that you move it, the more fine control you'll have over the
rocking action. Based on the size of my cube, I chose a value of -30. Now
select the rLeft null, grab its roll handle, and roll it to the left
(counterclockwise). Depending on the object you're rigging and the needs of
your scene, you may or may not want to rock it until its top edge touches the
ground. In this example, I rotated it until the Z-Rotate property was at 89.
This will establish that rLeft should rotate to 89 degrees on the Z axis when
the Rock null is at -30. If you slide the Rock null back toward 0 on X, you'll
see that rLeft rotates closer to 0 on the Z axis. When Rock reaches 0 on X,
rLeft is at 0 on Z-Rotate, and it won't go any farther...just what we want.
Now do the exact opposite for the rRight null. Move Rock to 30 on the X
axis, and roll rRight to the right the opposite amount that you did for rLeft;
in my case, I went to about -89 degrees. Now you should be able to select the
Rock null and move it side-to-side on the X axis and watch the box rock on its
left and right lower edges. If all looks good, close the relationship window.
To create the front-to-back rocking motion, create a relationship driven by
the Z-Translate of the Rock null, using essentially the same procedure as with
the side-to-side setup. With Rock at 30, rotate rFront about 89 degrees on the
X axis; with Rock at -30, rotate rBack about -89 degrees on the X axis. Test
the motion by moving Rock forward and back on the Z axis. When you're done,
close the relationship window.
You're now ready to put the rig through its paces. When using the rig,
though, you won't need to see the four contact nulls, so turn off their
visibility in the PWS by clicking on the visibility icon (the "eye")
next to each null in the model's Bones folder. This will keep the display clear
of excess clutter.
Test the Rig
Right-click (Command-click on a Mac) on the Action folder and select [New][Action]. Turn
the view a little until you're looking down onto the top of the cube from a
slight angle, and change the view to Shaded mode. Select the Rock null and use
the Translate tool to move the null around on the X and Z axes (hint: use the
manipulators centered on the vertical edges of the tool to move in X and Z
simultaneously). You'll notice that when two adjacent sides are rocking at the
same time, the cube will rock on the corner shared by those two sides. In the
figure to the right, I've added another cube to the action as a platform for
the first to rock upon, which makes the effect easier to see. I also restricted
the translation capabilities of the Rock null, allowing it to only move on the
X-Z plane.
By using relationships to give a single null control over all four rocking
directions, it provides a wonderful level of interactivity that would be
difficult to achieve with other multi-control rigs.
|