View Single Post
  #2  
Old 01-28-2004, 04:34 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

To get information about the viewer use the viz.get() command. Take a look in the command reference of the documentation for a more detailed description. Here's an example:
Code:
#Get the head position
pos = viz.get(viz.HEAD_POS)

#Get the yaw of the viewer
#Note: yaw refers to rotation about the Y-axis
yaw = viz.get(viz.VIEW_YAW)
Take a look at the duckcourt example in the tutorial folder for using crosshairs. Here's the basic idea:
Code:
import viz
viz.go()

#Add a texture quad to the screen
crosshair = viz.add(viz.TEXQUAD,viz.SCREEN)

#Apply your crosshair texture to the quad
#Make sure you have an image file with transparency
crosshair.texture(viz.add('crosshair.png'))

#Turn off the mouse cursor
viz.cursor(0)

def mytimer(num):
	#Update the crosshair position
	crosshair.translate(viz.mousepos()+[0])

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.01,viz.FOREVER)
Good luck!
Reply With Quote