Notifications
Clear all

[Closed] Handlers and callbacks

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:

 [b]when transform $controller changes do ( print ($controller.rotation as eulerAngles))[/b]

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.
2 Replies

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!

Thanks a lot, it works! Anyway it seems a bit clumsy to me; what’s the scope of ‘when transform changes’ clause then?