WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   how to do it using mouse (https://forum.worldviz.com/showthread.php?t=2026)

nasr 05-12-2009 02:38 AM

how to do it using mouse
 
Code:

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,vizact.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,vizact.elapsed(1),0,0,viz.RELATIVE_WORLD)
vizact.whilekeydown(viz.KEY_LEFT,hand.translate,vizact.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.elapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('s',hand.rotate,1,0,0,vizact.elapsed(-90),viz.RELATIVE_WORLD)
vizact.whilekeydown('d',hand.rotate,0,1,0,vizact.elapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('a',hand.rotate,0,1,0,vizact.elapsed(-90),viz.RELATIVE_WORLD)
vizact.whilekeydown('c',hand.rotate,0,0,1,vizact.elapsed(90),viz.RELATIVE_WORLD)
vizact.whilekeydown('x',hand.rotate,0,0,1,vizact.elapsed(-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


All times are GMT -7. The time now is 02:43 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC