PDA

View Full Version : Set Position with Script Controller and LOCAL axis


TerianSilva
07-18-2009, 05:09 PM
Hi,

to render a zDepth map and provide visual feedback for the focus region, i linked some values with wired parameters and it works fine.

But I want to show the focus start and end with a plane. So I took a plane, matched it to the camera position and added the axis value for the near distance.

All works fine in the script controller but... the plane has to move in local axis and it is always moving in gimbal/world/whatever axis.

I know that you normally use "in coordsys Local" to move in local axis but I have no idea how to apply that in the script expression.

Here is an image to illustrate the whole scenario:

http://img232.imageshack.us/img232/7707/20090718175649.gif

I assume it is just a question of the correct syntax but I have no clue. Just putting "in coordsys local" in front of all or just the value behind the plus(+) does not help.

Regards,
marcus

SyncViewS
07-18-2009, 05:57 PM
Hi Marcus,
try this:

camera.pos - ([0,50,0] * (camera.transform.rotationPart))

where [0,50,0] is the shift from camera (shouldn't it be in Z? like [0,0,50])
You may want to put an Orientation Constraint to Plane to make it stay perpendicular to the camera axis.

- Enrico

Ruramuq
07-19-2009, 02:09 AM
there is also the option of linking the plane to the camera, and it will inherit its transform.
then, just wire the axis of the plane with the parameter of the camara(ie:near range). you can use wires or and instanced controller(no maxscript)

TerianSilva
07-21-2009, 08:12 PM
Thanks a lot! I tried both suggestions and both are working :D

CGTalk Moderation
07-21-2009, 08:12 PM
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.