Thread: 3d-movement
View Single Post
  #3  
Old 10-06-2008, 02:49 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use the viztracker.Keyboard6DOF() object to setup keyboard navigation and link it to the CaveView object. Here is sample code:
Code:
import viztracker
keyTracker = viztracker.Keyboard6DOF()
viz.link(keyTracker, origin)
The Keyboard6DOF object uses the WASD keys by default for navigation. You can customize the keys by passing the following optional keyword arguments to the constructor:

forward - key for moving forward
backward - key for moving backward
right - key for strafing right
left - key for strafing left
turnRight - key for rotating right
turnLeft - key for rotating left

For example, if you wanted to use the arrow keys for moving around you would use the following code to create the keyboard tracker object:
Code:
keyTracker = viztracker.Keyboard6DOF(forward=viz.KEY_UP,backward=viz.KEY_DOWN,left=viz.KEY_LEFT,right=viz.KEY_RIGHT)
Reply With Quote