WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-19-2009, 12:34 AM
nlfrnassimi nlfrnassimi is offline
Member
 
Join Date: Feb 2009
Posts: 37
Question reseting actions

Hi, I have created a test code. In my code there is a ball that waits 5 seconds before it changes color, and according to the color changing there are balls moving around. after the actions have taken place, I want to reset them so that everything starts from the beginning. How can I do that?

Here is my code:

Code:
import viz

viz.go()

import viztask

viz.clearcolor( viz.SKYBLUE )
viz.add( 'tut_ground.wrl' )
ball1 = viz.add( 'white_ball.wrl' )
ball1.setPosition( 0, 3, 4 )

ball2 = viz.add('soccerball.ive')
ball2.setPosition(2,0.3,6)

ball3 = viz.add('soccerball.ive')
ball3.setPosition(-2,0.3,4)




def changeColor():
	while True:
		
		
		color = ball1.color(viz.RED)
		moveball2()

		yield viztask.waitTime( 5 ) 
		
	
		color = ball1.color(viz.YELLOW)
		moveball3()
	
		yield viztask.waitTime(5)
		

		color = ball1.color(viz.GREEN)
		rotateball3()
		safe()

		yield viztask.waitTime( 5 )
		stopRotate()
		
	
		
viztask.schedule( changeColor() )

def moveball2 ():
	ball2.addAction( vizact.goto ([-1,2,6] ) )
	

	
def moveball3 ():
	ball3.addAction( vizact.goto ([2,2,6] ) )
	
def rotateball3 ():
	ball3.addAction( vizact.spin([0,1,0],90,viz.FOREVER,100))

def stopRotate ():
	ball3.endAction()
	
def safe() :
	safe = viz.addText('SAFE', viz.WORLD)
	safe.setPosition(-1,2,5)
	safe.scale(.5,.5)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Best way to synchronize avatar actions mjabon Vizard 1 07-29-2008 11:15 AM
question regarding actions dan12345 Vizard 1 03-26-2008 11:28 AM
Spin Actions and rotations Vinicius Lima Vizard 1 10-22-2007 11:49 AM
Speech during actions zoltantoth Vizard 2 05-02-2007 03:11 PM
Weird lagging/choppiness when avatars perform actions vjonshih Vizard 8 11-30-2004 04:08 PM


All times are GMT -7. The time now is 04:29 AM.


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