WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Problems Ending Animation (https://forum.worldviz.com/showthread.php?t=4506)

atalantis 02-24-2013 10:52 PM

Problems Ending Animation
 
Hi,

So I'm running code so that an avatar runs a series of random animations one after another until the user signals the animations to stop with a key press. The problem comes up after the user has signaled the animations to stop. It stops the current animation, and then starts up a new one. This is even after I have told it to clearActions(). Perhaps I don't have a good grasp on how the action list works with the viz.FOREVER parameter.

Code:

teacher = viz.addAvatar('avatars/teacher/teacher1/teacher.cfg')
teacher.setPosition([0,0,0])
teacher.setEuler([180,0,0])
teacher.state(7)

def Start_Gestures():
        random_gesture = vizact.animation(vizact.randint(1,5), 3.0)
        teacher.runAction(vizact.sequence(random_gesture, viz.FOREVER))
       
def End_Gestures():
        teacher.clearActions()
        teacher.state(7)

vizact.onkeydown('s', Start_Gestures)
vizact.onkeydown('e', End_Gestures)

Any thoughts?

Thanks in advance!

tokola 03-01-2013 08:41 AM

atalantis,

as far as I know you cannot control avatar animations with the action library commands. Look for commands related to avatar animations. Examples are: .setAnimationState, .setAnimationSpeed, .stopAnimation, etc.

I hope this helps!

farshizzo 03-01-2013 11:49 AM

The default idle animation for the avatar is 1. It looks like you want animation 7 to be the idle animation. Use the following to change the idle animation:
Code:

teacher.idlepose(7)
The avatar will automatically start this animation when the action action is completed. You can also disable the automatic idle animation by setting it to -1. This allows you to fully control which animation the avatar enters.


All times are GMT -7. The time now is 02:54 PM.

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