Thread: meaning of code
View Single Post
  #3  
Old 07-13-2009, 01:59 PM
yak yak is offline
Member
 
Join Date: May 2009
Posts: 22
Quote:
Originally Posted by farshizzo View Post
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)
thanks you your teh man!
Reply With Quote