There are a number of get and set commands that can be used with imported animations. The following example shows how to set the speed, state, and loop mode on one of the animations included in the
piazza_animations.osgb file:
Code:
import viz
import vizact
viz.go()
viz.setMultiSample(8)
viz.fov(60)
viz.go()
# Add piazza model
model = viz.addChild('piazza.osgb')
# Add piazza animations
animations = viz.add('piazza_animations.osgb')
# Create avatar parented to walk animation
avatar_path = animations.getChild('walk')
avatar = viz.addAvatar('vcc_male2.cfg')
avatar.setParent(avatar_path,node='walk')
avatar.state(2)
#set animation time, speed, and loop mode
avatar_path.setAnimationTime(10.0)
avatar_path.setAnimationSpeed(1.5)
avatar_path.setAnimationLoopMode(0)
#toggle between pause/play
vizact.onkeydown(' ',avatar_path.setAnimationState,viz.TOGGLE)
viz.MainView.move([0,0,-7])