PDA

View Full Version : Aim


johnnyMac
08-28-2003, 08:18 PM
alright, here's the problem.

i have a polygonal plane that i've textured with a tree image. i want that plane to always point towards the camera BUT i only want it to rotate around it's Y axis only so when the camera moves up (Y direction) i dont want the tree to point up to it. i only want the heading information.

i'm using the aim constraint. how can i limit the X and Z rotation (attribute editor)? suggestions?

ok, back to the grind. thanks in advance.

johnnymac

Randolph
08-28-2003, 08:37 PM
You've answered your question yourself :)

Open the attibure editor of your plane,

go to the 1st tab (e.g. "plane1") scroll down to "limit information" and open "rotate".
Check the x and z fields and set the values to zero.

That's all.

johnnyMac
08-28-2003, 08:44 PM
i'm either really smart or need some serious therapy. i was trying to make my limitations in the aim constraint node and that wasnt working. anyway, thanks for pointing out that i'm just a little... bit... slooooow... today. :scream:

thanks for the help.

johnnyMac
08-29-2003, 10:35 PM
i remember what the problem is.

try taking a polygonal plane (stand it up like a tree) and aiming it to the camera (i am aiming the Z axis toward the camera) BUT take your camera and rotate it around the "tree" and watch it closely. it stays oriented towards the camera but at some point loses its orientation a 0 degrees.

i'm limiting the Z and X rotation to 0. the Y rotation i am leaving as is. i'm still screwing around with this but if you figure it out before i do lemme know. thanks.

misterdi
08-30-2003, 04:48 AM
Hmm, you might have a gimbal lock problems.

Change your rotation order according to main axis rotation, in your case should Y first, either choose yxz or yzx.

See whether it help,

Best regards,

misterdi
08-30-2003, 04:52 AM
BTW: Are you using Maya 5.0, I believe in Maya 5.0 you could specify axis to constraint in aim Constraint, either it's all axis, or X, Y and Z axis.

Best regards,

johnnyMac
08-30-2003, 02:57 PM
misterdi - thanks for the reply. i'm using 4.5. havent paid for the upgrade yet but i'm eager to. i'll give your suggestion a try when i get back in the office this weekend. the joys of owning your own firm... working weekends.

is there a way to select a bunch of objects and aim them toward the camera at once instead of individually selecting them? i've got looooots of trees. duplicating one after it's aimed doesnt seem to be working either even with duplicating the input nodes.

thanks again.

misterdi
09-01-2003, 05:01 AM
Write a small script to do it:

Here is a grab from the feedback on script Editor when you do aimConstraint

aimConstraint -offset 0 0 0 -weight 1 -aimVector 0 1 0 -upVector 0 0 1 -worldUpType "vector" -worldUpVector 0 1 0;

I change it slightly so you don't need to pick the persp camera and the plane, it should read like this:

aimConstraint -offset 0 0 0 -weight 1 -aimVector 0 0 1 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 "persp" "pPlane1";

If I need to do 100 planes which could be selected first I can write a script like this:


string $selections[] = `ls -sl`;
for ($sel in $selections)
{
aimConstraint -offset 0 0 0 -weight 1 -aimVector 0 0 1 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 persp $sel ;
}


What the script will do, it will loop for each selected object and do an aimConstraint on each to the persp camera.

Hope this help,

johnnyMac
09-01-2003, 04:18 PM
misterdi - mel script... i've gotta dive deeper into those. i'm making the switch from lightwave to maya and am figuring things out as i go. thanks for the script(s). i went around my site and hand picked each tree (bummer) but i still have more to do today. i'll give your script a try and maybe learn something in the process.

btw, your suggestions worked. i changed the order of rotation using the attribute spreadsheet and locked the rotation of the other channels.

CGTalk Moderation
01-16-2006, 12:00 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.