WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 10-18-2010, 09:45 AM
masaki masaki is offline
Member
 
Join Date: Jan 2008
Posts: 63
Hi,

I rewrote your code using the viztask module. I left sample code for you in the task function to wait for a key press or a certain length of time to pass before continuing on. You might want to look into using the viztask module instead of timers - samples are in the help doc.

Best,
Masaki

Code:
import viztask

def myTask():
	# wait for a certain length of time or a key press
	waittime = viztask.waitTime( 1 )	#define wait one second
	waitkey =viztask.waitKeyDown('0')	#define wait for 0 key press
	yield viztask.waitAny( [waittime, waitkey] )	# #wait for either waittime or waitkley
	while True: #while loop infinitely
		for agent in walking:
			agentposition = agent.get(viz.POSITION)
			agentgap = vizmat.Distance(agentposition, agent.set[agent.whichturn])
			if agentgap < .1:
				agent.whichturn += 1
				if agent.whichturn == agent.end:
					agent.whichturn = 0
			
			walk = vizact.walkto(agent.set[agent.whichturn][0],agent.set[agent.whichturn][1],agent.set[agent.whichturn][2])
			agent.addAction(walk)
			
			yield viztask.waitActionEnd( agent, walk )	#wait for walk action to end for agent
			print 'walk to', agent.whichturn, 'done' 
			yield viztask.waitTime(5) 	#wait 5 seconds before looping again
			
viztask.schedule( myTask() )
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
Animation Problem :( Greenwu Vizard 4 01-05-2017 02:14 PM
another bezier animation problem masaki Vizard 1 01-24-2008 02:29 PM
Animation Tracks.... k_iwan Vizard 2 03-26-2007 05:52 PM
problem with female animations vmonkey Vizard 1 10-07-2005 10:36 AM
freeze problem shai Vizard 10 12-01-2004 11:53 AM


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


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