Click to go home...

Edge-Rolling

As part of a short personal project, I created a rig to allow an object to rock from side to side and front to back on its lower edge. Quite a while after finishing the project, I challenged myself to expand the rig's capabilities so that it worked more effectively with objects that had round bases. I wanted to find a way to rock a circular–based object on any point of its lower edge, and also to provide capabilities for rolling the object on that edge.

Planning

The trick in designing this rig was to find a system that would allow the animator to dynamically change which part of the object's lower edge was in contact with the ground. They had to be able to move the two points of contact for the rocking rig in a complete circle, and have their positions drive the angle of the object. After some experimentation, the solution was achieved by adding an external roll target that was driven by a separate control, which allowed the spin of the object to remain constant as it rolled on its edge.

Create/import your model

For the purpose of this tutorial, I'm going to use the Wooden Barrel model that's on the Animation:Master CD under Data\Models\Props\Wooden Barrel. You can use this as well, or just make a simple circular–based shape by lathing a vertical (or at least mostly vertical) two–point spline. Make sure to move your shape so that its base is sitting on the X–Z plane (marked by the red line in the Front view).

Add rig components

The rig consists of ten nulls, one of which can be replaced by a bone if you choose (more on this later). You could add these nulls one at a time, of course, but there’s an easier way to get most of them added very quickly (some will be made as copies of others once they’re in certain positions, so we’re not going to add them all in this step). Add the first one the normal way by right-clicking (Command-clicking on a Mac) in the model window and selecting [New][Null]. In the PWS (Project WorkSpace), select this null and drag it onto the Bones folder while holding the CTRL key on your keyboard. Bingo...Null2 is made. Repeat this step with Null2 to get Null3, and so forth to add additional nulls up to Null8. Quickly run down the list and click the visibility icon (the little eye) to hide each null except the one you need to work with at any given time.

In the list below, I’ll suggest names for the nulls, but feel free to rename them as you wish. If you're using the Wooden Barrel from the A:M CD, you'll notice that it comes with an existing bone. Leave it to use as the Body bone (more on this below) and delete one null from the list.

RockRotate null placement

RockRotate

Purpose – This null will control the rotation of the rock rig, and consequently the model's point of contact with the ground.

Position – In the Front view of the model window, use the cursor keys to move this null straight up into the middle of the model (for easier selection later). This null needs to be aligned with the Y-axis, so select the null and change the X Rotate value to –90.

ContactPt

Purpose – This will be the primary point of contact with the ground.

Position – Using the cursor keys, move this null to the left so that its base aligns with the leftmost CP at the base of the model. In the PWS, drag this null onto RockRotate so that it becomes the child.

ContactPt and ContactRef null placement

ContactRef

Purpose – This null's base needs to lie exactly on top of ContactPt, and will primarily serve as a point of reference in the constraint system.

Position – Make this null by copying ContactPt in the PWS (click and CTRL-drag the null onto the Bones folder). Once the copy is made, rename it as ContactRef.


ContactPt2 null placement

ContactPt2

Purpose – This will be the secondary point of contact, and will lie on the exact opposite side of the model from ContactPt.

Position – Assuming your model is perfectly symmetrical and centered on the X-axis, create this null by copying ContactPt in the same way you made ContactRef. The copy will automatically be named ContactPt2. To move it to the opposite side of the model, make the start and end X values positive. Once this is done, go to the PWS and make ContactRef a child of ContactPt2, and ContactPt2 a child of ContactPt.


Body null/bone placement

Body

Purpose – This item can be either a null or a bone, depending on your model. If you don't have a rig already in your object, this will need to be a bone, to which you will attach all of the model's control points. If you’re using the wooden barrel model from the Hash CD, you can use the bone that already exists in the model as Body. However, if you have a rig that controls individual parts of your object, then make this a null, and drag the base item of your existing rig onto this null. Either way, this ensures that your entire model will move when the rolling rig is active.

Position – If this will be a null, leave it at its default position, changing the X Rotate value to -90. If you add this as a bone, first remove one of the nulls from the list in the PWS. Place the base of the bone at the very base of the model in the Front view, and pull its tip up to the top of the model. Drag a marquee around the entire model to assign all of its CPs to the Body bone. If you are using the existing bone in the Barrel model, rename that bone to Body, and drag it onto ContactPt2 in the PWS to make it the child. If necessary, tweak the bone’s start position to 0,0,0, and the X and Z end position values to 0. Whether you use a null or bone, make Body a child of ContactPt2 in the PWS.


RollPlace and RollTarget null placement

RollPlace

Purpose – This will control the placement of the RollTarget null (below).

Position – This null also needs to be aligned with the Y-axis, so select the null and change the X Rotate value to –90.

RollTarget

Purpose – This will be the roll target for Body, with its position around the object controlled by RollPlace.

Position – In the Top view, move this null straight up, placing it behind the center of the model.


Tilt, Contact, and Roll null placement

Tilt, Contact, and Roll

Purpose – These are the controls that you will use to operate the rig.

Position – In the Front view, position the nulls side-by-side somewhere to the right or left of the model, depending on your preference.


Hierarchy sample

When you're finished, the hierarchy in the Bones folder should look like the sample on the right. If not, adjust things as necessary. The exact order of the chains isn't important, but the parent–child relationships should be the same. Once everything looks right, you’re ready to add constraints.

Constraints

Create a new On/Off pose for the model, and name the pose something like "EdgeRoll." As the constraints are added, the principles behind the system will be discussed.

Body

Select the Body bone and add an Aim Roll At constraint pointing to the RollTarget null sitting behind the object. At first this won't appear to do anything, but it’s one of the main keys to the rig's functionality. What we basically want to do is let the object rock freely and tilt along with the rocking rig, but its roll amount needs to stay constant as different parts of the lower edge come into contact with the ground. This constraint adds that level of control.

Contact Points

For the ContactPt null, add the following constraints in order:

  • Roll Like --> Tilt
  • Euler Limits - Set Z Minimum to 0

For the ContactPt2 null, add the following constraints in order:

  • Roll Like --> Tilt
  • Euler Limits - Set Z Maximum to 0

This puts the control for rocking the rig into the Tilt control bone. Select the Tilt bone and manipulate its roll handle to see the basic rocking action. Undo any changes and make sure there are no channels under the Tilt bone in the PWS before proceeding.

Contact and Roll Controls

The first of these is very straightforward. Select the RockRotate null, and add a Roll Like constraint pointing to the Contact null. This allows you to roll the Contact null and spin the rocking rig in a circle, thereby changing the object's point of contact with the ground.

Select the RollPlace null and add a Roll Like constraint pointing to the Roll null. This allows you to change the position of RollTarget via the Roll null. If we were to use this alone, however, RollTarget would not always be in a proper position with regard to the center of the object. Test this by grabbing the roll handle of the Tilt null and turning it from side to side. As the object rocks, you'll notice that it also twists slightly so that Body's roll handle can properly point at the RollTarget null, which currently sits in a static position. What we need, then, is to keep RollTarget in relative alignment with the center of the object. We'll do that by adding two more constraints to RollPlace:

  • Translate To ––> ContactPt2
  • Translate To ––> ContactRef

This suspends RollPlace between the two other nulls and directly on top of Body, so that RollTarget maintains its position relative to Body at all times. RollPlace is still allowed to roll freely so that RollTarget can be moved to different positions around the object.

With that, the constraints are done and you can close the pose window. Be sure to remove any motion from the Tilt, Contact, and Roll control nulls, or they will become a permanent part of the pose. Also, to clean things up for easier animating, it's a good idea to hide unnecessary items in the rig. The only things that need to be visible are the three control nulls, so hide all the others in the PWS.

Testing the Rig

Create a new action. Open the rollout for the model and turn on the EdgeRoll pose. Select the Tilt null and turn its roll handle to rock the object back and forth. With the Tilt roll handle off to one side, select and move the roll handle of the Contact null to change the point of contact with the ground. For most uses this will be enough. For more extreme rolling on the object's edge, though, a more convincing roll can be produced by adjusting the roll handle of the Roll null a small amount over time. Use more roll at sharper angles, and less roll as the object starts to come to rest. A good example of this is a spinning coin. Watch it as it comes to a stop, and you'll notice that it turns very slightly while continuing a very rapid roll on its outer edge. I've created a short movie that shows the rig in action (MPEG-1, 303KB).

If you're going to be doing rapid edge rolls, you will probably want to change the interpolation of all nulls to Euler so that the nulls won't flip as you turn past 180-degrees. This can be done by going into the Animation:Master Properties panel (from the Tools menu), selecting the Action tab, and changing the Objects item in the Interpolation box to Euler.

Final Comments

Regarding the placement and orientation of the three control nulls, that's up to personal preference. I wanted to control the rig while looking at the front of the object. While this makes sense for the Tilt control, it's not quite as intuitive for using the Roll and Contact controls. You may want to turn these nulls -90 degrees on the X-axis so that they're pointing up, which will let you use the Top view to more accurately "dial in" the angles you want.

To save this rig for later use in other models, simply delete all of the model’s CPs and save the model with a new name like "RollingRig.mdl". Import the rig model into an existing model, and adjust the positions of the ContactPt, ContactPt2, ContactRef, and RollTarget nulls as needed for your model.

Finally, I'm in the process of working on an even more detailed rig that will allow you to move the point of contact on the ground so that it stays underneath the object's center of mass, making for a more accurate spin at sharp angles. Check back later for more!