View Single Post
  #6  
Old 01-30-2004, 09:58 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

If you want to snap the viewpoint to a certain location when a key is pressed then you will use a KEYBOARD_EVENT. This is an event that is triggered whenever a key is pressed. Here is an example that will place the viewpoint at the position [1,2,3] and reset the orientation whenever the 's' key is pressed:
Code:
import viz
viz.go()

def mykey(key):
	if key == 's':
		viz.reset(viz.HEAD_ORI|viz.BODY_ORI|viz.HEAD_POS)
		viz.translate(viz.HEAD_POS,1,2,3)

viz.callback(viz.KEYBOARD_EVENT,mykey)
Good luck!
Reply With Quote