Clamp To Constraint
Mode: Object and Pose modes
Panel: Constraints (Object context and sub-context, F7, or Editing context, F9, when in Pose mode)
The Clamp To constraint is a constraint which is particularly useful for moving things along large and complex paths which would otherwise be hard to hand-key smoothly.
The idea of a Clamp To constraint is very similar to the Follow Path one, with one main difference: where the last one uses the time Ipo of the target curve, Clamp To will get the actual location properties of its owner (those shown in the Transform Properties panel, N), and judge where to put it by “mapping” this location along the target curve.
As with most things, of course, there’s a bright side and a dark side.
The bright side is that when you are working with Clamp To, it will be easier to see what your owner will be doing, since you are working in the 3D view, it will just be a lot more precise than sliding keys around on a time Ipo and playing the animation over and over.
The dark side is that, unlike in the Follow Path constraint, Clamp To doesn’t have any option to track your owner’s rotation (pitch, roll, yaw) to the banking of the targeted curve, but you don’t always need rotation on, so in cases like this it’s usually a lot handier to fire up a Clamp To, and get the bits of rotation you do need some other way.
Follow Path rotation functionality can be replicated, for instance by clamping an Empty to the same path, animating it in front of the object, and using a Track To constraint locked to the empty.
All together, what this means is that it will probably be much easier to animate varied motion across a curve than it might be if you were using Follow Path, but even if it’s not easier, it’s an interesting alternative, so it can just come down to personal choice…
- This constraint uses one target, which must be a curve object, and is not functional (red state) when it has none.
- Main Axis
- This button group controls which global axis (X, Y or Z) is to be used as reference to position the owner along the target curve.
- There’s no real wrong choice, so just pick the axis that would be easiest to work with, or that works best in your current situation. A good idea is picking the axis which the target curve is the longest along, so that the global and constrained locations of the object will be more similar to each other – or you can just use the default Auto option, and Blender will make its best guess.
- By default, once the owner has reached one end of its target curve, it is stuck to it if you continue to move it in the same direction. When the Cyclic option is enabled, as soon as it reaches one end of the curve, it is instantaneously moved to its other end.
- This is of course primarily designed for closed curves (circles & co), as this allows your owner to go around it over and over…
This is the Dark and Stygian lock example – you don’t need to know what Stygian means, but before you all start throwing full wine bottles at your computer screens, looking at the picture to the right should give you a fair idea.
All the fancy design-work aside, though, the face and door are just decoration. The actual animation is done by the Clamp To constraint on the knob. If you watch, you’ll see that the motion of it slides around the edge of the disk, goes back and forth, and even stops sometimes, and still manages to keep in a circle. This is the bright side of using a curve. Trying to key this the regular way would probably take much longer, and be much less smooth.
The bright side of, not just using a curve, but actually using a Clamp To constraint in this case – instead of a Follow Path one – happens around half-way through the animation. The knob slides all the way around, and then past the face’s mouth, and keeps going a little while, before stopping and sliding back. Since the actual curve begins and ends in the figure’s mouth, there needs to be an emergency key frame to jump the knob from being near the mouth at the end of the curve, to being near the mouth at the beginning. To do this, we have to visually move the location for both the keys as close to each other as possible, to make the transition smooth, this is something that would be much more difficult with the targeted curve’s time Ipo.
When this example was created, the Cyclic option did not existed yet – so nowadays, you don’t even have to bother “jumping back” your owner with close keyframes, just enable the Cyclic button, and continue to move your owner further away, it will smoothly pass the mouth and happily begin another turn…
I decided, in a spur of last-minute inspiration, that the camera would use a Clamp To constraint as well. It may seem a bit belabored, but we might as well go all the way and be consistent. It’s a demo file, after all!