If you are using the keyboard to update the projections and the joystick to drive the CAVE around you can do something like this.
Code:
#Create tracker object using the keyboard (WASD keys control the viewpoint, the user's eye location)
#Make the starting location for the user's eye the exact center of the CAVE
viewtracker = viztracker.KeyboardPos()
viewtracker.setPosition (W/2.0,H/2.0,D/2.0)
#Pass the viewpoint tracker into the cave object so it can be automatically updated
cave.setTracker(pos=viewtracker)
#Create CaveView object for manipulating the entire cave environment
#The caveorigin is a node that can be adjusted to move the entire cave around the virtual environment
caveorigin = vizcave.CaveView(viewtracker)
#update caveorigin with joystick
MOVE_SPEED = 5 # meters/sec
def joyMove():
#Use y position of joystick to drive CAVE forward
forwardMovement = viz.elapsed() * MOVE_SPEED * -joyPOS[1]
caveorigin.setPosition([0,0,forwardMovement],viz.REL_LOCAL)
#Use x position of joystick to drive CAVE side to side
sideMovement = viz.elapsed() * MOVE_SPEED * joyPOS[0]
caveorigin.setPosition([sideMovement,0,0],viz.REL_LOCAL)
vizact.ontimer(0, joyMove)
When using the vizcave module the viewpoint should not be updated with:
Code:
viz.MainView.setPosition()
The viewpoint will update properly if you set a tracker for the CAVE and use the CaveOrigin object to drive the CAVE around.