PDA

View Full Version : Handlers and callbacks


la_piaga
10-13-2005, 02:40 PM
Hi there. I have to correlate the rotation of 2 objects (controller and object) within some defined properties, so hi have to catch the controller transormation to evaluate it and set the object accordingly.
first i tried with handlers with weird results; to make it short, take this script snippet as an example:

when transform $controller changes do ( print ($controller.rotation as eulerAngles))

Anyone can tell me why my controller rotation is being updated during transformation correctly only on X axis, having a bizarre behaviour on Y axis and not being updated at all on Z axis?!?

So i tried with the registerRredrawViewportsCallback mechanism and i found the controller rotation being updated correctly during trasformation but now the problem is in the destination object rotation setting. Even if i force the .rotation setting and a cache flushing at every callback the destination object is updated only at the end of the controller transformation.

Any suggestions? Thanks.

j-man
10-13-2005, 02:46 PM
can you use a script controller?


dependson $myotherobject
$myotherobject.pos*2


If you place this in a script controller of the position of another object, it will move twice the amount of the object named myotherobject

Don't know if this helps!


la_piaga
10-13-2005, 03:50 PM
Thanks a lot, it works! :) Anyway it seems a bit clumsy to me; what's the scope of 'when transform changes' clause then?

CGTalk Moderation
10-13-2005, 03:50 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.