16th Aug2011

Building 3 Joint Chains With Aim Constraints

by bbentley81

In the previous post I talked about the proper setup for a three joint chain. In this lesson I will show a more precise way to create this setup.

As mentioned before the previous setup is clean but what happens when you HAVE to have your pivots on exact locations, like with mechanical rigs. To position a joint chain using the previous technique would be rather painful. Lets look a a different way to do this, using an aim constraint to find the normal vector to the the plane formed by the three positions in space we are trying to mach.

The sounded like a lot. We’ll take this one thing at a time. Any three points will make a plane. Think of a piece of paper. If you can place three dots on that paper and move it around in space. The dots are our joints and the paper is the plane that they make. Now take three push pins and poke them though each dot. These are your normals to that paper plane.

If you look at the paper on edge you will see the all the shafts of the push pins are parallel! And because I had neither paper or pushpins as I am writing this I am using the magic of 3d to illustrate this idea to you.

Figure 1

Figure 1

So here is how we go about finding the “pushpins”, which is the z axis in this illustration. We use aim constraints. To see more about aim constraints check out my post on them.

So lets say you have three locations in space that your joints have to hit exactly. (posA, posB, posC)

Figure 2

Figure 2

STEP 1:

use the joint tool and go into an orthographic view and draw three joints in a straight line. It doesn’t matter now long the chain is, just that the joints are there.

Figure 3

Figure 3

STEP 2:

point constrain the the first joint to the posA object

STEP 3: (this is were the magic happens)

Open up the aim constraint option box. Set the “ world up type” to “object up” and put the name of posC object in the field (in my case it was called loc3), and make sure maintain offset is off. Select the posB object and then the first joint and pres apply.

Your first joint should now be aiming at the posB object. But why did we use the last position as an up object? What that gives us is the two vectors we need to define our third (see aim constraint post).

To check and see if you are on the right track, create a polygon plane and parent it under the first point. Now zero all the transformations. You may have to put 90 in the aiming axis (x in my case) but that is ok.

If you scale up the plane big enough you will see it now passes directly though the center of all three positions!

Figure 4

Figure 4

STEP 4:

Point constrain the second joint to the posB object. If you have done this correctly you should now only have values in the aiming channel (in my case it is x):

STEP 5: (more magic)

Open the aim constraint option box again. This time change the “World up type” to “Object rotation up” and put the name of your first joint in the field. Also put zeros in all of the up vector fields except the ones that would be be the “pushpins” from earlier (in my case it is z). Do this also for the “world up vector” option.

Now select your posC object and your second joint and press apply. If you have done this right you should have rotations in only one channel (z in my case).

Figure 5

Figure 5

STEP 6:

Point constraint your last joint to the posC object and zero out its rotations, jointOrients, and rotateAxis values if it has any.

STEP 7:

Delete the plane and all the point and aim constraints you have made. Select the top joint and run modify > freeze transformations to move the joints rotation values into the jointOrient.

Figure 6

Figure 6

DONE!

 

You may be asking yourself, “why go to all this trouble? why not just point snap the joints and be done with it?” Hers is why, your joint orients will not be clean if you just point snap your joints into place.

 Here is what I am talking about:

Figure 7

Figure 7

The sad part about this is that no amount of gratuitous use of the joint orient tool will fix this travesty. If you do run into a situation were you absolutely cannot change the orientation of your joints, I would suggest building a clean chain. Place nulls under each joint that have the exact same orientation as the joint with wonky rotate axis and then point and orient constrain them to these nulls.

This way you keep your strangely oriented joints and you have a clean chain to put ik or other controls on. I hope this helps!

 CHEERS

B