Tutorial 3.2

Bone constraints

Introduction

This tutorial demonstrates Moho's bone constraint features. Bone constraints allow you to define limits on the way bones can move, simplifying your animation work. When used carefully, bone constraints can let the bone structures do some of the work for you.

Start With a Sample File

For this tutorial, we'll start with a project file that's almost finished. It's named "Tutorial 3.2" and it's located in the "Tutorials/3 - Bones" subfolder within the main Moho folder. Open this file in Moho, and you should see something like this:

Starting point for this tutorial.

This file contains two skeleton layers that have no constraints set up. We're going to add constraints to these skeletons to show how useful they can be.

Angle Constraints

Select Bone

The first type of bone constraint is angle limits. By limiting the angle that a bone can rotate, you can prevent arms and legs from bending backwards. Make sure the Arm layer is selected, and then use the Select Bone tool to select the bone in the forearm as shown below:

Select the forearm bone.

When the Select Bone tool is active, the Bone Constraints popup box will be available in the tool options area of the main Moho window. Click the Bone Constraints popup to open it, and adjust the settings as shown below. Specifically, turn on the "Angle constraints" checkbox, and set the min/max angle fields to -10 and 100.

Set angle constraints.

Click the Close button to close the constraints popup box. Then, set the bone's name to "Forearm" - we'll see why later.

Name this bone "Forearm".


Manipulate Bones

Once you've set up angle constraints, you can see them in the working area as two lines around the bone that indicate the minimum and maximum angles the bone is allowed to rotate between. Try using the Manipulate Bones tool and move the forearm - notice how Moho doesn't allow you to move the bone beyond the minimum and maximum angles you set up.

Visual display of angle constraints.

Tip: Here's a handy little trick. Often, it can be hard to judge the correct numerical angles for bone constraints. There's an easy way to adjust them if you have a mouse with a scroll wheel. Hold the mouse over the angle constraint you wish to change (in the Bone Constraints popup), and roll the mouse wheel up and down. The angle will change, and the display in the editing view will update to match. With this method, you can watch the display in the editing view and not worry so much about the actual numerical value.

Control Bones

The next type of bone constraint allows one bone to control the motion of another. This is a way to set up simple "automatic" animation. Select the small bone above the upper arm:

Selected bone.

Bring up the Bone Constraints popup again, and select "Forearm" from the "Angle control bone" popup menu (this is why we named it earlier), and enter the value 0.5 in the angle control field as shown below:

Angle control setup.

We'll do something similar for the small bone below the upper arm. Select that bone, and set "Forearm" as the angle control bone, but this time set the angle control value to -0.5.

Manipulate Bones

Finally, use the Manipulate Bones tool again to move the forearm. Notice that now the muscles in the upper arm move automatically - this is what the Angle Control Bone does - it tells other bones to move automatically when it moves.


Bone Locking

The third category of bone constraint is "bone locking". When you lock a bone, you're telling Moho that you don't want it to move. Moho will try to keep the bone still by moving its parents as necessary to keep the bone in place. This isn't always possible (depending on what else is happening in the animation), but it is still an extremely useful feature.

Select the "Frank w/Skeleton" layer in the project. Bone locking is often used to keep a character's feet from moving around on the ground. To do this, Moho needs to move the character's legs automatically. Thus, it helps to use angle constraints to keep the knees from bending backwards. Select Frank's left shin bone as shown:

Select the left shin.

Now set up angle constraints for this bone. The minimum angle should be -10, and the maximum should be 120:

Angle constraints for left shin.

Now select the right shin, and set it's angle constraints to -120 and 10.

Translate Bone

OK, the legs are prepared. Set the time to frame 24. Use the Translate Bone tool to drag Frank's spine bone around a small distance. Notice that his feet move around and don't stay in place. Go back to frame 0 and select the left foot bone:


Select the left foot.

In the tool options area, turn on the "Lock bone" checkbox for this bone. Next, select the right foot bone and turn on "Lock bone" for it as well.

Lock both foot bones.


Translate Bone

Now that the feet are locked, go back to frame 24, and use the Translate Bone tool again to drag Frank's spine around. Notice that now Moho tries to keep Frank's feet locked to the ground. If you lift Frank too high, his legs will completely straighten out and his feet will lift from the ground - there's really no helping that, the same thing would happen to you if you were lifted off the ground. You can try rotating the spine bone too and see how the skeleton reacts.

Locked feet.

Bone locking is an animated parameter. You can turn on and off bone locking as many times as you want during an animation. This is especially useful when making a character walk - lock a bone as soon as a foot hits the ground, and unlock it just before the foot is to leave the ground for its next step.