View Full Version : Aim constraint on a single axis? (Maya)

 swimtrunx10 October 2010, 06:37 PMI'm trying to constrain an object to rotate only on Y to follow another object which will be moving all around. This is for a character rig, but the effect would be similar to a tank turret turning to follow a target. You don't want the tank turret flipping around on X or Z. When I create the Aim Constraint, I set it to constrain Y only. Now setting my aim vector, I've been getting some really strange results. 1, 0, 0 - the constrained object ignores X movement of the target object, and only detects Z movement. (I'm Y-up) -1, 0, 0 - the constrained objects better tracks the target, but in the +X -Z quadrant it starts turning the opposite direction and then does a 180-degree pop as the target crosses into +X +Z 0, 0, 1 - the constrained object seems to do a mirror-like track. If the target object moves to the -Z side of the constrained object, then the rotation bounces and goes back the other direction. (edit: actually, if the target object moves below the constrained object, then the constraint works perfectly and the constrained object always points toward the target.) 0, 0, -1 - this seems to work as I would expect, so long as the target object's position is higher on Y than the target object. If it goes below the target on Y, then I get the same bouncing rotation, but facing the other direction. So it looks like I have to use the Z axis. If the target will be in +Y as compared to the constrained object, then I should set the aim vector to -Z. If the target will be in -Y, then I should set the aim vector to +Z. Well I sure hope that the target doesn't cross the X-Z plane or my rig will break. My up vector is set to "vector" at 0 1 0. Can anyone tell me why this is acting so weird? I'm using Maya 2009 64-bit on Windows 7, but I've had this problem for years on 32-bit XP as well. I'm obviously missing some key setting here, but I'm unable to locate any details in the Maya docs. thanks
Pascaru
10 October 2010, 09:29 PM
I just tried this out, and it works:

Create 2 locators, followLocator and controlLocator.
Set followLocator on the same translateY as your object.
Connect its translateX and translateZ to the controlLocator's translateX and translateZ.

Now if you move controlLocator in space, the followLoc will follow everywhere, but in the XZ 2D space.

Now aim constrain your object to that followLocator. It'll just rotate on one axis, following the controlLocator.

Hope this helps..

swimtrunx
10 October 2010, 12:11 AM
Thanks Pascaru, that does answer my question about getting the aim constraint to work.

So I tried implementing it for this robotic arm (very similar to a Microscribe arm), and I discovered that as I go a few levels deep on my armature it broke this technique because I was having to move the locators in the parent space of the robot arms. The locators moved on the right plane, but the aim constraint went wacky again.

So maybe I need to look at learning to use the more complicated rig tools instead of my simple 2-bone IK with extra aim constraints added. I need to find out if I can post a picture of the robot arm or if that's secret info.

Thanks for the help
Scott

CGTalk Moderation
10 October 2010, 12:11 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1