Log in

View Full Version : Problems Ending Animation


atalantis
02-24-2013, 10:52 PM
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.


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: <node3d:avatar>.setAnimationState, <node3d:avatar>.setAnimationSpeed, <node3d:avatar>.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:
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.