View Single Post
  #9  
Old 03-19-2009, 01:35 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
each time prep is called another vizact object is created.
Code:
def prep():
	viz.MainScene.visible(viz.OFF)
	vizact.onkeydown(' ', sceneOn,1)
The first time in prep when spacebar is pressed sceneOn gets called 1 time, if you click your mouse again and then the space bar, there are two vizact objects calling sceneOn twice, and so on. That's why more than one object is moving.

Probably the best thing to do is to re-arrange your code using viztask. Waiting for mouseclicks, keypresses, and timers can all be done within the task function. Check out the documentation on viztask and let me know if you have any questions.
Reply With Quote