import viz
import vizconnect
import vizfx
import vizact
viz.setMultiSample(8)
#Need to create and save vizconnect file in your main folder Tools- Vizconnect
vizconnect.go('vizconnect_config.py')
headlight= viz.MainView.getHeadLight()
headlight.disable()
#change name to the name of your model that is saved in your main folder
env = vizfx.addChild('warehouse.osgb')
#change name to the name of your avatar that is saved in your main folder
female = vizfx.addAvatar('female.osgb')
female.state(1)
#morph example
morph = vizact.morphTo(23,1,time=2)
def closeEyes():
female.addAction(morph)
vizact.onkeydown('1',closeEyes)
#Get a handle to the Neck bone
neck = female.getBone('NeckTwist01')
neck.lock() #Disable automatic animation so that we can manually animate it
#Lock the head bone so that manual movement of the neck bone also moves the child head bone
female.getBone('NeckTwist02').lock()
#Lock the head bone so that manual movement of the neck bone also moves the child head bone
head = female.getBone('Head').lock()
def faceView():
#Make head look at viewpoint
viewPOS = viz.MainView.getPosition()
neck.lookAt( viewPOS, mode=viz.AVATAR_WORLD )
neck.setEuler([180,-135,0],viz.REL_LOCAL)
#call function that updates Avatar orientation every frame
vizact.ontimer(0, faceView)