Notifications
Clear all

[Closed] script controller uses parent instead of world coordsys

I’m having an issue with a script controller, if I have 3 objects in my scene, object1 which has a position controller on the X track and object 2 linked to object 3 at [100,100,100].

 
Object1.pos.controller .X_Position.controller = float_script ()
Object1.pos.controller .X_Position.controller .addtarget "startpoint" object2[3][1][1]
posX =” startpoint+10”
Object1.pos.controller.X_Position.controller.setExpression posx

Everything works without any problems, my script runs and the Object1 gets the float script applied to the X position controller, the issue I’m having is that it’s using the parent space of object2 instead of world space of object2 to the compute the x position.

IE: if object 2 is in the exact same position as object3 then object 1 reads it at 0.0 instead of its world location which should be 100.0

I have even tried using “(in coordsys world startpoint)+10” for the expression to no avail.

Any and all help is appreciated

2 Replies

All animation controllers in Max (not just scripted ones) operate in parent space. They only work in world space if the object is child of the world (no parent).

[font=Arial][color=white]Thanks bobo

I found the work around, instead of adding object2 by using ‘addtarget “startpoint” object1[3][1][1]’ i used ‘addnode “startpoint ”object2’ and changed the exression from ”startpoint+10” to “(in coordsys world startpoint.pos.x) +10”.

It functions the way I need it too while allowing me to keep my hierarchy intact

[/color][/font]