You could link the viewpoint orientation to the head tracker:
Code:
viz.link(headTracker,viz.MainView,mask=viz.LINK_ORI)
Then calculate the change in x, z position every frame based on body tracker yaw and joystick data and set the viewpoint position:
Code:
viz.MainView.setPosition([x,0,z],viz.REL_GLOBAL)
Or you could set the viewpoint body orientation so position movements are relative to that and then adjust the final viewpoint orientation:
Code:
MOVE_SPEED = 5
def updateViewpoint():
x,y,z = joy.getPosition()
move_amount = MOVE_SPEED * viz.getFrameElapsed()
viz.MainView.move([x*move_amount,0,y*move_amount], viz.BODY_ORI)
headOri = headTracker.getEuler()
bodyOri = bodyTracker.getEuler()
viz.MainView.setEuler([bodyOri[0],0,0],viz.BODY_ORI)
viz.MainView.setEuler([headOri[0] - bodyOri[0],headOri[1],headOri[2]])
vizact.onupdate(0,updateViewpoint)