16th Jul2011

Demystifying the Aim Constraint

by bbentley81

Out of all the constraints in Maya the aim constraint seems to give beginners the most headaches. This is most likely due to the fact that there is little explanation of this concept of “Up”. The best way to think of “Up” is not the physical direction but as a vector in space.

Anything that rotates is Maya (and all 3d apps for that matter) gets this rotation from three vectors. These three vectors all have a length of one and are at 90degree angles to one another These vectors are calculated In such a way as to produce the rotation of the object.

Illustration 1: a locators three axis of rotation

Illustration 1: a locators three axis of rotation

In Maya you can visualize these vectors in several ways;

 

Through the main menu:

display > Transform Display > Local Rotation Axis

Illustration 2: visualizing local rotation axis with the Maya menu

Illustration 2: visualizing local rotation axis with the Maya menu

Through the attribute editor:

In the attribute editor under the Display tab. Toggle “Display Local Axis”

Illustration 3: visualizing the local rotation axis with the attribute editor

Illustration 3: visualizing the local rotation axis with the attribute editor

you can also do this though commands:

mel:

setAttr “locator1.displayLocalAxis” 1;

 python:

cmds.setAttr(“locator1.displayLocalAxis”, True)

What we mean when we say “Up” is really “what axis should we use for the cross product”. What is the cross product you ask? By taking the cross product of two vectors that are a length of one and are at 90 degrees to one another we get a third vector that is also one unit in length and 90 degrees to both input vectors.

That was all pretty heady lets look at some examples:

here is the aim constraint option box:

Illustration 4: the default aim constraint options window

Illustration 4: the default aim constraint options window

This is a lot of info so we will step through it one at a time. Aim Vector is the axis we want to point at our target. The first field is x, second y third z. (this is true for almost all three field inputs in Maya). The up vector field is what we’ve explained previously. It is the axis that we will use to define the third axis vector. So Maya defaults to aiming the x axis at the target and uses the y axis to calculate the z axis.

The next three fields work together to place the up vector. Think of this as telling what is in the “Up vector” field were to go.

Here are the default settings. We are aiming the x axis at our target and telling the y axis to point up in y.

Illustration 5: aiming with the default settings

Illustration 5: aiming with the default settings

here is another example were we are telling our y axis to point in x:

Illustration 6: changing the "up" position from y to x

Illustration 6: changing the "up" position from y to x

Now what if we want to change were out “Up” is pointing. In these two examples the up placement is static. By using the “Object Up” and  “Object Rotation Up” options we can define the position of our up vector.

I this example we use “Object Up” and specify an object in the scene. The “up” vector will now always aim to this object. The rotation of the object in this example is irrelevant.

Illustration 7: using another objects position as the up

Illustration 7: using another objects position as the up

I the next example the “Object Rotation Up” is now being used with the same object. We can see here that the orientation of the y axis of the aiming object now matches the x axis of “World up object”. The position of the object in this example is irrelevant.

Illustration 8: using another object's rotation to determine up

Illustration 8: using another object's rotation to determine up

 

By effectively controlling the “up” of an aiming object you have options that far exceed the capability of the more simple point, orient and scale constraints.

 

CHEERS

B.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>