What do I need to do to this script to make it move along its local x axis?
I believe "in coordsys local" should be placed in here but I am not seeing it.
I would appreciate some assistance.
ResetMaxFile #noPrompt tag = teapot name:"Tea" dir:[1,1,0] tag.position.controller = Position_XYZ () utility TeapotMoveSpinner "TeapotMoveSpinner" ( ----- open utility group "Teapot Mov By Spinner" ( spinner TeapotPositionMoving2 "Tea Pot Position Moving:" fieldwidth:75 range:[-100,100,0] type:#integer align:#right ) on TeapotPositionMoving2 changed val do ( tag.position.controller.x_position = val ----does not work ) ) ----close utility
Solved! Go to Solution.
Solved by Swordslayer. Go to Solution.
Basically, you can either link the object to a parent so that its controller values (which are always in parent space, when not assigned a parent, parent space simply == world space) can be directly linked to the ui control:
( delete objects local tag = teapot prefix:"Tea" dir:[1,1,0] parent:(Point dir:[1,1,0]) try destroyDialog ::TeapotMoveSpinner catch() rollout TeapotMoveSpinner "TeapotMoveSpinner" width:200 ( group "Teapot Mov By Spinner" ( spinner TeapotPositionMoving2 "Teapot Position Moving:" \ fieldwidth:40 range:[-100,100,0] type:#integer align:#right \ controller:tag.position.controller[1] ) ) createDialog TeapotMoveSpinner )
Or you can calculate the new position yourself:
( delete objects local tag = teapot prefix:"Tea" dir:[1,1,0] try destroyDialog ::TeapotMoveSpinner catch() rollout TeapotMoveSpinner "TeapotMoveSpinner" width:200 ( group "Teapot Mov By Spinner" ( spinner TeapotPositionMoving2 "Teapot Position Moving:" \ fieldwidth:40 range:[-100,100,0] type:#integer align:#right ) on TeapotPositionMoving2 changed val do ( tag.pos = val * x_axis * tag.transform.rotationPart ) ) createDialog TeapotMoveSpinner )
thank you. Of the two solutions, calculating new position myself worked best.