View Single Post
  #2  
Old 11-21-2012, 10:09 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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])

Last edited by Jeff; 12-01-2012 at 10:31 AM.
Reply With Quote