Facebook
From Baby Ostrich, 2 Years ago, written in Python.
This paste is a reply to Reallusion to Vizard from Sado - view diff
Embed
Download Paste or View Raw
Hits: 238
  1. import viz
  2. import vizconnect
  3. import vizfx
  4. import vizact
  5.  
  6. viz.setMultiSample(8)
  7.  
  8. #Need to create and save vizconnect file in your main folder Tools- Vizconnect
  9. vizconnect.go('vizconnect_config.py')
  10.  
  11. headlight= viz.MainView.getHeadLight()
  12. headlight.disable()
  13.  
  14. #change name to the name of your model that is saved in your main folder
  15. env = vizfx.addChild('warehouse.osgb')
  16.  
  17. #change name to the name of your avatar that is saved in your main folder
  18. female = vizfx.addAvatar('female.osgb')
  19. female.state(1)
  20.  
  21. #morph example
  22. morph = vizact.morphTo(23,1,time=2)
  23. def closeEyes():               
  24.         female.addAction(morph)
  25. vizact.onkeydown('1',closeEyes)
  26.                
  27. #Get a handle to the Neck bone
  28. neck = female.getBone('NeckTwist01')
  29. neck.lock() #Disable automatic animation so that we can manually animate it
  30.  
  31. #Lock the head bone so that manual movement of the neck bone also moves the child head bone
  32. female.getBone('NeckTwist02').lock()
  33.  
  34. #Lock the head bone so that manual movement of the neck bone also moves the child head bone
  35. head = female.getBone('Head').lock()
  36.  
  37. def faceView():
  38.     #Make head look at viewpoint
  39.     viewPOS = viz.MainView.getPosition()
  40.     neck.lookAt( viewPOS, mode=viz.AVATAR_WORLD )
  41.     neck.setEuler([180,-135,0],viz.REL_LOCAL)
  42.  
  43. #call function that updates Avatar orientation every frame
  44. vizact.ontimer(0, faceView)