Hi all,
I want to create a slider which drives an objects translate Y value, however I want the object to move according to a different objects “object space”
eg in this script a sphere object is created, whose translation Y value is being driven by the slider.
There’s also a cube which has been rotated 45 degrees in X.
When I move the slider, I would like the sphere to move in the cubes translate Y(according to the cubes object space), so instead of moving straight up, it will move up at an angle of 45 degrees.
I feel like I maybe need to make use of the world matrix to query the vectors for each objects translation, then find the offset between the two sets of vectors.
Then somehow add this offset to the spheres translation.
But I’m just guessing really, this stuff is a bit beyond me :surprised
Anyone have any ideas how to do this?
Thanks.
import maya.cmds as cmds
#create ball and cube objects
cube_obj = cmds.polyCube()
cmds.move( 2,0,0,cube_obj)
cmds.rotate( 45,0,0,cube_obj)
ball_obj = cmds.sphere()
# create slider
cmds.window( title='Attr Field Slider Groups' )
cmds.columnLayout()
cmds.attrFieldSliderGrp( min=-0, max=20, at='nurbsSphere1.translateY')
cmds.showWindow()
