Thread: meaning of code
View Single Post
  #2  
Old 07-13-2009, 09:59 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
That code is adding a spin action to the object when the slider is moved. If you want to move through an avatar animation using the slider, the following code should help:
Code:
import viz
viz.go()

#Initialize avatar
male = viz.add('vcc_male.cfg')
male.setPosition(0,0,5)
male.setEuler(180,0,0)

ANIM = 6
DUR = male.getDuration(ANIM)

#Start animation
male.execute(ANIM)
male.setAnimationSpeed(ANIM,0) #Speed must be set after animation is executed

#Use slider to modify animation time
slider = viz.addSlider(pos=(0.5,0.1,0))
def myslider(pos):
	male.setAnimationTime(ANIM,pos*DUR-0.01)
vizact.onslider(slider,myslider)
Reply With Quote