If you want to move your object with the mouse along just the x-axis you could either translate mouse movement into object movement with something like this
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)
ball = viz.add('ball.wrl')
def mymouse(e):
#Move the object based on the mouse position
ball.setPosition((e.x-0.5)*6,2,8)
viz.callback(viz.MOUSE_MOVE_EVENT, mymouse)
or you could move the object with the mouse buttons
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)
ball = viz.add('ball.wrl', pos = [0,2,8])
#use buttons to control ball
vizact.whilemousedown(viz.MOUSEBUTTON_LEFT, ball.translate,vizact.elapsed(-1),0,0,viz.REL_PARENT)
vizact.whilemousedown(viz.MOUSEBUTTON_RIGHT, ball.translate,vizact.elapsed(1),0,0,viz.REL_PARENT)