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)