WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   actions (https://forum.worldviz.com/showthread.php?t=1177)

mjabon 08-08-2007 04:07 PM

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)


farshizzo 08-10-2007 04:51 PM

Hi,

Thanks for the sample. This will be fixed in the next release.


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

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