WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-08-2007, 04:07 PM
mjabon mjabon is offline
Member
 
Join Date: Jul 2007
Posts: 63
actions

Hello. When I run a script just trying to make an avatar walk and wave and then pause the avatar.pauseActions(viz.ALL_POOLS) does not pause him.

It works in 2.5 but not 3.0. This is the script:

Code:
import viz

viz.go()

WALK_TIMER = 998
WAVE_TIMER = 999								# id for the wave timer
WAVE_FREQUENCY = 5								# how often to wave in seconds (avatar will wave every WAVE_FREQUENCY seconds)


# print keyboard instructions
print "\nKeyboard instructions:"
print "press 's' to start"
print "press 'p' to pause the avatar"
print "press 'r' to resume actions"
print "press 'q' to quit"

avatar = viz.addAvatar('male.cfg')
randomwalk1 = vizact.walkto(2,0,5)
randomwalk2 = vizact.walkto(0,0.15,5)
wave = vizact.animation(5)

def mykeyboard(key):
	global avatar
	if key == 's':
		viz.starttimer(WAVE_TIMER, WAVE_FREQUENCY, viz.FOREVER)
		viz.starttimer(WALK_TIMER, .1, viz.FOREVER)
	if key == 'p':
		avatar.pauseActions(viz.ALL_POOLS)
#		avatar.pauseActions(1)
#		avatar.pauseActions(2)
	if key == 'r':
		avatar.resumeActions(viz.ALL_POOLS)
	if key == 'q':
		viz.quit()
		
		
viz.callback(viz.KEYBOARD_EVENT,mykeyboard)

def myTimer(num):
	global avatar
	if num == WAVE_TIMER:
		avatar.addAction(wave,2)
	if num == WALK_TIMER:
		avatar.addAction(randomwalk1,1)
		avatar.addAction(randomwalk2,1)

					
viz.callback(viz.TIMER_EVENT, myTimer)
Reply With Quote
 

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


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


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