View Single Post
  #2  
Old 02-13-2009, 01:07 AM
moooh moooh is offline
Member
 
Join Date: Dec 2008
Posts: 19
You will just have to set the ball value to None and the ball should stay at its current position as your code already checks whether or not a ball is active before trying to move it.

You could alter the mouse down function to pick up the ball if none is selected and drop the ball if currently holding one, like this:

Code:
def mouseclick(button):
    global ball
    if button == viz.MOUSEBUTTON_LEFT:
        if not ball: #we are not holding a ball, try to pick one up
            pickObj = viz.pick()
            if pickObj.valid():
                ball = pickObj
        else: #we were holding a ball, drop it
            ball = None
or instead of changing the mousedown function you could make it so that pressing a key on the keyboard drops the ball:
Code:
def dropBall:
    global ball
    ball = None
vizact.onkeydown( 'd', dropBall )
This will drop the ball when the d key is pressed.
Reply With Quote