WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-12-2009, 11:21 PM
nlfrnassimi nlfrnassimi is offline
Member
 
Join Date: Feb 2009
Posts: 37
Unhappy moving and object by mouse but don't know how to stop the movement

my code is to select a ball and move it by mouse, I want to click a key and the ball will remain in that position, but have no idea how to do it.

please help

this is my code :


import viz

viz.go()

ground = viz.add('tut_ground.wrl')
viz.clearcolor(0.5,0.5,1)
ground.disable(viz.PICKING)

soccerball1 = viz.add('soccerball.ive')
soccerball2 = viz.add('soccerball.ive')
soccerball3 = viz.add('soccerball.ive')

soccerball1.translate(-1,1.5,3)
soccerball2.translate(0,1.5,3)
soccerball3.translate(1,1.5,3)

viz.mouse(viz.OFF)

def mouseclick(button):
global ball
if button == viz.MOUSEBUTTON_LEFT:
pickObj = viz.pick()
if pickObj.valid():
ball = pickObj


def mymouse(e):
global ball
if not ball:
return
else:
ball.setPosition((e.x-0.5)*3,e.y*3.5,3)


viz.callback(viz.MOUSEDOWN_EVENT,mouseclick)
viz.callback(viz.MOUSE_MOVE_EVENT,mymouse)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I stop an action? nlfrnassimi Vizard 4 02-13-2009 01:59 AM
Pick porblem with arrays shivanangel Vizard 3 08-27-2007 11:10 AM
Moving view with object Xliben Vizard 2 07-25-2005 06:36 PM


All times are GMT -7. The time now is 07:56 PM.


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