The Aim constraint is another important constraint that we use in
character animation.
And it allows one object to be aimed at another.
You may have encountered the Aim constraint when doing lighting and rendering.
It's used often to aim a light at an object or camera, so that the camera or the
light will follow an object through the scene.
We can also use Aim constraints in character animation to position things such
as the eyes, to make the eyes point at a specific locator.
So in this scene, I have two eyes and a single locator here that we can use as an aim.
So let's take a look at how to set up an Aim constraint for the eyes.
I am going to select my locator first and then Shift+Select eye right.
Remember, the constrained object is always selected last and it should be
highlighted in green.
And then I am going to go over to Constrain > Aim.
Now in these options, we have Maintain offset, which allows you to basically
maintain the initial position of the eye.
We also have the Aim vector, and that is along which axis is this aiming?
Is it aiming along X, Y or Z, or a combination of any of those?
And then also, you know, what is your up vector for the object?
In other words, it's aimed at an object, but also how is it rotated along that axis.
World vectors as well, and then of course, along which axes we want to constrain.
Now in this case, I'm just going to go ahead and click on Maintain offset, and
let's go ahead and add that, so we can see how that works.
And when we do that, basically nothing changes, and the eye just stays in
place and now we can go ahead and move this and you can see how it kind of
moves to match the locator.
But if you notice here because we set maintain offset, it's actually not looking
directly at that locator.
It's looking a little bit to the side.
Now this can be very handy if that's what you want, but let's go ahead and do
this a little bit more precisely.
Let's go ahead and delete this constraint and re-create it.
Probably the easiest way to delete a constraint is to go into the Outliner, find
the object Eye_Rt, which has a constraint, and you will notice that the
constraint is underneath the object.
So all we have to do is select that and hit Delete, and that gets rid of the constraint.
So now when I move this, the object does not constrain.
So let's go ahead and re-create this constraint.
So again, I'm going to select the locator, Shift+Select the eyeball, again, the
constrained object is last, go into Constraint > Aim constraint, and let's go
into our options here.
And in this case, I'm going to turn off Maintain offset, and just leave
everything else at the default.
And let's go ahead and hit Add.
And as you can see, the eye jumps a little bit to its right.
Now the reason it's doing that is because right now we are aiming along the
default axis, which is the X axis.
Now we can change that in that Aim constraint option here.
We have the Aim vector is right now 1 along X, 0 along Y and Z, but if we want
to change it later, we can always go into the Attribute Editor.
So I'm going to make sure my eye is selected, go into the Attribute Editor, and
find the Eye_Rt_aimConstraint.
Then all we have to do is find that Aim vector.
In this case, you can see the red axis, or the X axis, is pointing towards that locator.
We want the blue axis or the Z axis to point.
So let's go ahead and 0 out the X axis, and notice how that already snaps.
And then let's go ahead and make it 1 along Z. So now that I have this, you can
see it's pointing towards that locator a lot more precisely.
And usually, this is the way that we want to set these things up.
So now that we know exactly how to set it up, let's go ahead and set it up
for the second eye.
So I'm going to click on this eye here and you can see that the blue axis again
is the axis we want, so I'm going to select my locator, Shift+Select Eye_Lt, go
into Constrain > Aim constraint, and in this case I don't want this to be
constrained to X, I want it to be constrained to Y, hit Add, and there we go.
So now, I can select my locator and the eyes will follow.
So obviously, this guy is a little bit cross-eyed, but we can certainly do
multiple locators if we want, and we'll get into that a little bit more
precisely, in the later chapters.
But as you can see, the Aim constraint can be used to point up one object at
another, and there is a number of ways to use this in character rigging.