Constraints are object features that define spatial relationships between objects, and are the standard method for controlling characters among all 3D animation packages that still implement a more traditional approach to digital character animation. In Blender, constraints can be associated to any type of object or bone object, but not all constraints work with bone objects, and not all constraints work with normal world objects.
Constraints are accessed via the object buttons (F7) in the Constraints panel. After you press the Add Constraint button and select the desired constraint type from the menu, a constraint UI is added to the panel. The constraint will be linked to the active object or the active selected bone, indicated by the label To Object: or To Bone: on the right of the Add Constraint menu.
Constraints are evaluated in a specific order: from top to bottom of the constraint stack. This order can be viewed and changed inside the Constraints panel. Each constraint has a pair of arrow buttons on the right of the constraint name in its top right corner, which can be used to move the constraint up or down the constraint stack. The little cross on the right of these buttons can be used to delete the constraint from the stack.
NOTE: The name field of a newly added constraint will appear red, which indicates that the constraint is not functional. In the case of a newly added constraint this is because the constraint does not yet have a target specified. All constraints require a target object (a normal world object or an armature bone). You should enter the name of the desired target object in the Target: OB field. When you want an armature bone as target, enter the name of the armature object as target. A new field with BO: will appear, where you can place the name of the target bone.
The name field of a constraint will also turn red if the settings for the constraint are invalid or if the constraint conflicts with another constraint. For example: A Track To constraint of which the To and Up vector are set to Z.
The influence of a constraint on the actual location/rotation/size of the object can be defined with the Influence value slider. This can be linked to an Ipo Curve, which can be evoked in the Ipo Curve Editor with the button Show on the right of the Influence value slider. The Key button beside it can be used to add a key to the Ipo Curve.
You can key any constraint, and an object can have multiple constraints keyed to exert a different influence at different times.
Multiple Influence Example
Suppose that you want a camera to follow one path for awhile and then drift off and follow another path. You apply a follow path constraint to a camera for one circle/curve/path (make sure you have curve path enabled and enter its name), then open up an IPO curve window. In the buttons window (constraint panel) you can either hit I and insert an Influence value by sliding the slider (to vary the force strength or force fall off) or LMB click the "key" button at the bottom of the constraint panel. Once you have inserted the initial key, up arrow or change to the frame where you want the first influence to start falling off. Go to the IPO window and and CtrlLMB to insert a key. Go forward a few frames, where you want its influence to be zero, and insert another key, and edit it so that its Y value is zero. At that frame, the constraint in the stack will not influence the camera motion at all. Now insert a second Follow Path constraint, and enter the name of the second path. Now position back a few frames and insert a key to where you want its influence to start (probably where the first constraint starts dropping off). Edit this second influence curve to come up from zero to one over time. You can imagine that the IPO curves for each circle should cross over each other so that when one is at full influence (max 1.0) the other is at zero etc. You might have to play with the curves a bit to get the transition smooth.
Constraints on Bones
Concerning bones with constraints: the color of the bones in the 3D Window indicate what type of constraint is used:
- Grey: No constraint.
- Yellow: A bone with an IK constraint.
- Orange: A bone with an IK constraint but no target.
- Green: A bone with any other kind of constraint.
- Blue: A bone that is animated with keyframes.
- Purple: The Stride Root.
Copy Location forces the object to have the same location as its target. When this constraint is used on a bone and another bone is the target, a new button--labeled Local--appears next to the X Y Z buttons. Using the local button causes the local translation values of the target to be given to the constrained object. In rest position, all bones are at the local location of (0,0,0).
Left: Using global space. This is the default behavior; it's what happens when the local button is not activated. Right: Using local space, with local button activated.
In these last two images, the constrained bone (shown in green) is actually a child of the root bone (the bone at the beginning of the chain). This demo shows possible uses for the location constraint in a rig. Note that the green bone still inherits rotation from the root because the root is its parent. This is by design though; the green bone could be the child of any of these bones, or none of them.
Copy rotation causes one object to match the rotation of a target object. For bones, a local option will appear, allowing you to use local space. Imagine you have a bone pointing up and a bone pointing down. If you use local space, each can point different directions, but when the target bone moves to its left, the affected bone will move it to its left.
Left: Using global space. Right: Using local space.
Here is one good use of the rotation constraint and local space. By setting the influence value to 0.5, the small bone will rotate half as far as the target. This is useful for character joints.
Copy Scale forces the affected object to have the same size as the target. All bones have a (1,1,1) size in rest position. We can draw a bone that is 10 million times longer than the bone right next to it, but in pose mode, they both have a starting size of (1,1,1). You should keep this in mind if you're going to be using the copy scale constraint.
These constraints limit the scale, rotation, or location of the active object. The limit can be named, and is always specified in XYZ terms. Each limit min or max must be enabled by LMB , turning it dark green.
- Limit Location
- The object cannot be located or positioned below the minimum, or above the maximum amount. Use this to constrain an object to only move within a confined space.
- Limit Rotation
- The object cannot be rotated below the minimum, or above the maximum amount. Use this to constrain a bone, for example, not to hyperextend.
- Limit Scale
- The object cannot be scaled below the minimum, or above the maximum amount.
The Track To constraint applies rotations to the object, so that it always points a local “To” axis towards the target object, with another local “Up” axis permanently maintained as vertical as possible. This tracking is similar to the billboard tracking in 3D. This is the preferred tracking constraint, because it has a more easily controlled constraining mechanism.
The “billboard tracking”
The term “billboard” has a specific meaning in real-time CG programming (i.e. video games!), where it is used for plane objects always facing the camera (they are indeed “trackers”, the camera being their “target”). Their main usage is as support for tree or mist textures: if they weren’t permanently facing the camera, you would often see your trees squeezing to nothing, or your mist turning into a millefeuille paste, which would be funny but not so credible…
This constraint shares a close relationship to the IK constraint in some ways. This constraint is very important in rig design, and you should be sure to read and understand the tracking tutorial, as it centers around the use of both of these constraints.
- The axis of the object that has to point to the target.
- The axis of the object that has to be aligned (as much as possible) with the world Z axis. An Align: Target button, when enabled, uses the coordinates of the target object's Z axis, thus tilting or rocking the object as it tracks the target.
- Head/Tail - With Bone targets only
- A number from 0.0 to 1.0 that represents the place on the target bone to Track to (0.0 = the bone's root; 1.0 = the bone's head)
The Floor Constraint allows you to use a target object to specify the location of a plane which the affected object cannot pass through. In other words, it creates a floor! (or a ceiling, or a wall). This only works by default with planes of the global coordinate system.
- Makes the affected object immovable when touching the plane (cannot slide around on the surface of the plane), which is fantastic for making walk and run animations.
- Takes the target object's rotation into account.
- A number of BU's from the object's center. Use this to account for the distance from a foot bone to the surface of the foot's mesh.
- Which axis is the floor? Things normally stick "down" Z, but can walk on walls as well.
- Head/Tail - With Bone targets only
- A number from 0.0 to 1.0 that represents the place on the target bone to use for the Floor (0.0 = the bone's root; 1.0 = the bone's head)
Locked Track is a difficult constraint to explain, both graphically and verbally. The best real-world example would have to be a compass. A compass can rotate to point in the general direction of its target, but it can’t point directly at the target, because it spins like a wheel on an axle. If a compass is sitting on a table and there is a magnet directly above it, the compass can’t point to it. If we move the magnet more to one side of the compass, it still can’t point at the target, but it can point in the general direction of the target, and still obey its restrictions of the axle.
When using a Locked Track constraint, you can think of the target object as a magnet, and the affected object as a compass. The “Lock” axis will function as the axle about which the object spins, and the “To” axis will function as the compass needle. Which axis does what is up to you! If you have trouble understanding the buttons of this constraint, read the tool-tips; they’re pretty good. If you don’t know where your object’s axes are, turn on the Axis button in the Draw panel, Object context (F7). Or, if you’re working with bones, turn on the Draw Axes button, Armature panel, Editing context (F9).
This constraint was designed to work cooperatively with the Track To constraint. If you set the axes buttons right for these two constraints, Track To can be used to point the axle at a target object, and Locked Track can spin the object around that axle to a secondary target.
This constraints also works very well for 2D billboarding.
This is all related to the topic discussed at length in the tracking tutorial.
- The name of the target object that the tracking object tracks.
- This is only available when tracking to a mesh object. If you type in the name of a vertex group of the target, it will be the center of this vertex group that will be the “physical” target, not the object’s center.
- This is only available when tracking to an armature object. If you type in the name of a bone of the target, it will be this bone that will be the “physical” target, not the armature’s center.
- The tracking axis. It shouldn’t be the same as the Lock axis.
- The locked local axis.
- This controls how accurately the tracking object tracks the target. 0 means that the constraint is turned off. The tracking object will remain locked in orientation. 1 means tracking is completely on and the tracking axis will stay tightly focused on the target.
- This adds an influence Ipo channel to the constraint if one is not present. You can then add keys to the channel.
- This adds animation keys to the influence Ipo channel. This is a very powerful combination. For example, you could have a camera with a Locked Track constraint applied and have input driving the influence channel.
Follow Path places the affected object onto a curve object. Curves have an animated property that causes objects along the path to move. In order for this to work, you have to have the CurvePath option activated (it's a property of the curve object). You can find it in the Curve and Surface panel in the Editing buttons, F9.
The movement along the path might be controled by two different ways: the most simple, in this same Curve and Surface panel, is to define the number of frames of the movement via the num button Path Len:, and its start frame via the constraint's Offset: option (by default: start frame 1 (= offset of 0), duration 100).
The second way much more precise and powerful is to define a Speed IPO curve for the path (Path section of the IPO Curve window). The start position along the path will correspond to an IPO value of 0.0, and the end position, to an IPO value of 1.0. You can therefore control the start frame, the speed of the movement, and the end frame, and even force your object to go forth and back along the path!
If you don't want objects on the path to move, you can give the path a flat speed IPO curve (its value will control the position of the object along the path).
Follow Path is another constraint that works well with Locked Track. One example is a flying camera on a path. To control the camera's roll angle, you can use a Locked Track and a target object to specify the up direction, as the camera flies along the path.
This constraint does not work well with bones.
- The number of frames to offset from the "animation" defined by the path (by default: from the frame 1).
- If this option isn't activated, the affected object's rotation isn't modified by the curve; otherwise, it's affected depending on the following options:
- The axis of the object that has to be aligned with the forward direction of the path.
- The axis of the object that has to be aligned (as much as possible) with the world Z axis.
- In fact, with this option activated, the behaviour of the affected object shares some properties with the one caused by a Locked Track constraint, with the path as "axle", and the world Z axis as "magnet"…
Stretch To causes the affected object to scale the Y axis towards a target object. It also has volumetric features, so the affected object can squash down as the target moves closer, or thin out as the target moves farther away. Or you can choose not to make use of this volumetric squash-'n'-stretch feature, by pressing the NONE button. This constraint assumes that the Y axis will be the axis that does the stretching, and doesn't give you the option of using a different one because it would require too many buttons to do so.
This constraint affects object orientation in the same way that Track To does, except this constraint bases the orientation of its poles on the original orientation of the bone! See the page on Tracking for more info. Locked Track also works with this constraint.
- Pressing the R button calculates the rest length as the distance from the centers of the constrained object and its target
- Rest Length
- Rest Length determines the size of the object in the rest position
- Volume Variation
- Volume Variation controls the magnitude of the effect
- The Vol: buttons control along what axes the volume is preserved (if at all)
- The Plane buttons define which local orientation should be maintained while tracking the target
The IK Solver constraint is Blender's implementation of inverse kinematics. You add this constraint to a bone and then it, and the bones above it, become part of the inverse kinematic solving algorithm.
- Toggle option to make the IK chain follow the rotation of the target object.
- Use Tip
- Toggle option to use the tip of the bone instead of the base to solve the IK to. This option toggles between the old Blender behaviour (don't use tip) and new behavior (use tip).
- The number of bones above this bone that you want to be affected for IK. The default is 0, which means all bones above this bone will be used for IK.
- Weight of position control for this target.
- Weight of orientation control for this target.
- Maximum number of solving iterations.
The Action constraint allows you to map any action to one of the rotation axes of a bone.
The null constraint doesn't do anything. It is an antiquated feature.