between the position, orientation, or scale of an object to other
objects. In other words, a constraint is a way to link the attributes
of an object to the attributes of a second object which is great for
getting a character to interact with his environment easily. For
example, you can use constraints to have an animated character hold a
cup without having to reposition it into his hand on each frame.
While you will probably rarely ever need to do this, you can also
constrain one object to two or more other objects and Maya will place
the first one inbetween the other objects
There are quite a few different ways to constrain in Maya, which means
the first thing we have to think of when setting up a constraint is
how do we need it to work and which constraint type should we choose?
Constraint Types
Does an item need to be held firmly, or does a compass have to keep
pointing north? Let's go over the most common constraint types and see
what they can be used for:
- Point - A point constraint causes an object to
move to and/or follow the position of another object, or the average
position of several objects. This is useful for having an object match
the motion of other objects. With the point constraint, only the
translation of an object is constrained, allowing you to animate the
rotations freely. Very useful if you need a camera to stay on a moving
object, but still maintain control over where it's pointing. - Aim - An aim constraint constrains an object’s
orientation so that the object aims at other objects. Typical uses of
the aim constraint include aiming a light or camera at an object or
group of objects. In character setup, it is usually used to set up a
locator that controls eyeball movement. - Orient - An orient constraint matches the rotation
of one object to one or more other objects. This is useful for making
several objects orient simultaneously, for example, if you had to animate
a train's wheels as it's going down the track, you could animate one
wheel then constrain all the other wheels to the one you animated to get
them all going together. - Scale - A scale constraint matches the scaling of one
object to one or more other objects. This constraint is useful for
making several objects scale simultaneously. While probably the least
used of the constraints, it is pretty handy if you have multiple ojects,
such as juggling balls, and need to scale them all to a certain size. - Parent - Probably the most widely used of all the
constraints, it links the position (translation and rotation) of one
object to another, effectivly pinning it. This is what you'd use if you
need to have a character hold a cup. Be sure you don't confuse it with
Parenting though, which is an entirely different subject. While both
achieve the same result, they go about it in different ways.
Parenting places the constrained object (also called a "child") into a
hierarchy and if used improperly, can destroy a rig's own hierarchy,
effectivly breaking the rig. With Parent constraining, on the other
hand, the constrained object does not become part of the constraining
object’s hierarchy, but remains independent and with it's attributes
linked, behaves as if it is the child of the constraining object.
Another difference is that while Parenting only allows you to have one
parent per child, Parent Constraining lets you use multiple parents,
placing the object at the average distance between them.
Misc Tips
While constraining, remember that to constrain properly, you first need
to choose the parent, then the child.
With Parenting on the other hand, the selection order is reversed, so
you choose the children first, then the parent.
This can be hard to keep track of as you're working and it takes some
time before it comes naturally. The way I remember it is by keeping in
mind that since Parenting can have multiple children, I need to select
all of children first then the parent. For constraining, I just reverse it.
Now you might be thinking, since a parent constraint links both
translation and rotation, couldn't I use a point and orient constraint
to achieve the same result?
You can, and in some instances, it will give you more control but be
wary as an object with a Parent Constraint does not behave the same as
an object with a point and orient constraint. When a Parent Constraint
is used, rotating the constraining object(s) affects the constrained
object’s rotation along the world axis. When a Point and Orient
Constraint are used, rotating the constraining object(s) affects the
constrained object’s rotation along its local axis. Here's an example:
As you can see, with the Parent Constraint, the sphere's path goes
around the other object as if that object was it's pivot. On the other
hand, with Point and Orient Constraints, the sphere continues to rotate
on its own axis, causing it to follow an entirely different path.
Also, a couple of very useful settings most of the constraint types have
are the "Maintain Offset" option, which you can get to by clicking the
box beside the constraint in the menu and the Constraint axes options,
which allows you to choose whether to constrain the object completely,
or just on one or two of the axis.
When Maintain Offset is checked, the difference will be kept between
position, rotation, and/or scale of the constraining and constrained
objects. If you are constraining a cup to a hand, you will want to make
sure Maintain Offset is turn on to keep the cup from snapping into
another position.
While turned off, it will snap the constrained object to the position,
rotation, and/or scale of the parent object.
Whew! That was quite a long winded explanation! Let's move on to a
subject that, while not entirely related to constraints, can help you
diagnose what's going on with your constraints.
Attribute Colors
You've probably noticed, either when keying your character, exploring
the rig, or constraining objects, that the attributes in the channel box
are sometimes different colors. Now as animators, we know that red means
that there is a key on that attribute, but what do the other colors mean?
- Normal - Nothing to see here, just a regular old
attribute going about its business. - Gray - Locked. A locked attribute can not be edited or
changed. - Light Gray - Nonkeyable. As the name suggests,
nonkeyable attributes can not be animated. - Brown - Muted. This means that a keyed attribute has
had it's animation turned off or frozen. Muting attributes can come in
very handy if you want to focus on a certain aspect of your animation,
such as the arcs of a bouncing ball, without being distracted by the
rotation. - Red - Keyed. An attribute that has a key on the
timeline. As animators, this is a color we'll be seeing a lot during our
careers. - Blue - Constrained. Means that this attribute has been
constrained to another object. If you try to edit this attribute, it
will revert back to its constrained value when you scrub through the
timeline. - Green - Blended. This is what happens when you key a
constrained attribute. Once keyed, the attribute will turn green and a
new Blend attribute will appear. The Blend allows you to turn the
constraint on and off, which is great if you need your character to put
down his coffee mug. This is the preferred way of turning off a
constraint. If you are turning it off by editing the constraint node, it
can lead to problems later on when you need to re-time your animation. - Yellow - Connected. While constrained attributes link
different values, Connected attributes are linked mathematically to
another attribute, most often, so that one equals the other. - Purple - Expression. Purple means that this particular
attribute's values are determined by a piece of code.
tip so far, I hope it will help you understand constraints a little bit
more. Next time, I'll be going over a few of my favorite constraint
methods which should be a bit more useful to you.
If you have any questions or comments, please feel free to send either
of us a comment or message via Skype, AMConnect, or PM.
No comments:
Post a Comment