Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 21-04-2008 , 02:30 PM
Dutch's Avatar
Registered User
Join Date: May 2005
Posts: 49

Aim Constraint Issue

I'm having an issue with aim constraints. In the image below are two gun turrets: one on top of the ship and one on the bottom. I went ahead and grouped all the items in the turret which would have up/down rotation and placed a constraint on them (ensuring that the center of rotation was correct for the group). I quickly verified that this worked by moving the locater, I linked them to, up and down. Everything appeared to be working correctly. Then I grouped everything that would rotate side to side and made sure the pivot was in the center. I made an aim constraint on the same locater that only moved in this axis. A quick side to side test verified that it was working (or so it seemed).

The problem is that when I move the locater toward the rear of the ship the turret moves in an unpredictable manner. The 180 degrees in front behave exactly as I want but the 180 degrees behind don't work.

Even more odd is the fact that I duplicated the same steps on the lower turret and I don't end up with the same issue. It has 360 degrees of movement that works as expected.

I created a sensor dish toward the rear of the ship (also on the upper side) with similar movement requirements as the upper turret. After following the same process, I run into the same issue as the upper turret.

In the help file (yeah, I actually checked it) I found a vague reference that said something about aim constraints acting unpredictable when the target nears the global up axis. I have no idea what this means or how to fix it. Does anyone have a clue as to what is going on?

Note: History on each item is deleted and translations are frozen. I'm using Maya 6.5

user added image

# 2 21-04-2008 , 02:39 PM
Dutch's Avatar
Registered User
Join Date: May 2005
Posts: 49
May have just found my own answer.
https://caad.arch.ethz.ch/info/maya/m...m3.html#177795

Something to do with the World up vector and the aim vector as it nears it. The fix involves changing or animating the world up vector. I'm not sure I want to do that. I may just put in a different animation control to save myself the trouble.

# 3 21-04-2008 , 11:52 PM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
Actually, you can use a combinations of expressions and parenting to achieve the effect - no aim constraints needed.

Although I've found that the system doesn't point at it exactly - probably due to rounding errors (it gets noticeably better the farther away the target gets). But its pretty close regardless.

Setup - basically, just parent your gun in your turret to your turret base (or to whatever controls you have). Then, you'll need some variant of the following equations;
for the base:
base.rotateY = atan2d((target.translateX),(target.translateZ));
- this basically points the base at what would be the target's position seen from above.-
for the gun:
gun.rotateZ = atan2d(target.translateY, sqrt(target.translateX * target.translateX + target.translateZ * target.translateZ));
-this points the gun at the target vertically, and assumes that the gun is already pointing at it horizontally.-

the second equation is a little bit messy, and that's where most of the divergence is seen (most likely due to rounding errors). You should be fine with anything over 20 units away, though.

Actually, by bringing this up, you may have helped me come up with a way to solve an old problem of mine. Hope this helps!


Book Wise

https://X4nd5r.deviantart.com
# 4 23-04-2008 , 12:14 AM
Dutch's Avatar
Registered User
Join Date: May 2005
Posts: 49
Thank you for the tips

I actually ended up going back and using a control object with an orient constraint instead of the aim constraint. It works enough to get the job done. I doubt this will be going through any major animation, so getting any more involved would be a waste of my time.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads