View Single Post
  #1  
Old 02-24-2013, 10:52 PM
atalantis atalantis is offline
Member
 
Join Date: Feb 2013
Posts: 1
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!
Reply With Quote