View Single Post
  #2  
Old 03-17-2015, 01:05 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
You can register callback functions with vizact.onkeydown and vizact.onkeyup to start and stop the sounds:

Code:
import viz
import vizact

viz.go()

viz.addChild('piazza.osgb')
avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,0,6],euler=[180,0,0])
avatar.state(1)

def avatarWalk():
	avatar.playsound('footsteps.wav',viz.LOOP)
	avatar.state(2)
	
vizact.onkeydown(viz.KEY_DOWN,avatarWalk)

def avatarStop():
	avatar.playsound('footsteps.wav',viz.PAUSE)
	avatar.state(1)
	
vizact.onkeyup(viz.KEY_DOWN,avatarStop)
Reply With Quote