Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Animation (https://simplymaya.com/forum/forumdisplay.php?f=14)
-   -   Aim Constraint Issue (https://simplymaya.com/forum/showthread.php?t=29681)

Dutch 21-04-2008 02:30 PM

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

http://lh3.ggpht.com/barichter/SBXoN...vette_guns.jpg

Dutch 21-04-2008 02:39 PM

May have just found my own answer.
http://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.

Xander-0 21-04-2008 11:52 PM

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!

Dutch 23-04-2008 12:14 AM

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.


All times are GMT. The time now is 01:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018