View Single Post
  #2  
Old 10-17-2013, 02:27 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Yes, you can link the viewpoint to the head bone of the walking avatar:
Code:
'''
Toggle avatar with spacebar
'''
import viz
import vizact
import vizinfo
viz.go()

vizinfo.InfoPanel()

ground = viz.addChild('ground.osgb')
avatar = viz.addAvatar('vcc_male2.cfg',pos=[0,0,2],euler=[180,0,0])
avatar.runAction(vizact.walkTo([0,0,15]))

head = avatar.getBone('Bip01 Head')
link = viz.link(head,viz.MainView)
link.preTrans([0,0.2,-0.7])
#Set viewpoint pitch to 0
link.setEuler([None,0,None])

vizact.onkeydown(' ',avatar.visible,viz.TOGGLE)
If you want the viewpoint to bounce more try commenting out the line:
Code:
link.setEuler([None,0,None])
Reply With Quote