PDA

View Full Version : how to do it using mouse


nasr
05-12-2009, 02:38 AM
def toggleLink():
global link
if link:
#If link exits, stop grabbing
link.remove()
link = None
else:
#If no link, grab the ball with the hand
link = viz.grab( hand,ball )

vizact.onkeydown(' ',toggleLink)


#Setup keyboard control of hand and ball
vizact.whilekeydown(viz.KEY_UP,hand.translate,0,vi zact.elapsed(1),0,viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_DOWN,hand.translate,0, vizact.elapsed(-1),0,viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_RIGHT,hand.translate,v izact.elapsed(1),0,0,viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_LEFT,hand.translate,vi zact.elapsed(-1),0,0,viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_RETURN,hand.translate, 0,0,vizact.elapsed(1),viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_SHIFT_R,hand.translate ,0,0,vizact.elapsed(-1),viz.RELATIVE_WORLD)


vizact.whilekeydown('w',hand.rotate,1,0,0,vizact.e lapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('s',hand.rotate,1,0,0,vizact.e lapsed(-90),viz.RELATIVE_WORLD)
vizact.whilekeydown('d',hand.rotate,0,1,0,vizact.e lapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('a',hand.rotate,0,1,0,vizact.e lapsed(-90),viz.RELATIVE_WORLD)
vizact.whilekeydown('c',hand.rotate,0,0,1,vizact.e lapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('x',hand.rotate,0,0,1,vizact.e lapsed(-90),viz.RELATIVE_WORLD)



i want to do the same using mouse.. how to translate and rotate. im using a marker and linking it with the mouse pointer..how can i rotate the ball using the mouse?

thanking you all