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

Okay, in that case you need to turn off automatic head tracking and manually apply the rotations. You want to apply the yaw rotation of the intersense to the body orientation and the pitch,roll to the head orientation. Here's some code to help you:
Code:
import viz
import sid

viz.go()

isense = viz.add('intersense.dls')

#Get the main viewpoint object
viewpoint = viz.get(viz.MAIN_VIEWPOINT)

def mytimer(num):
	y = sid.get()[1]
	x = sid.get()[0]
	#Get the data from the intersense
	data = isense.get()
	#Apply the yaw to the body orientation
	viewpoint.rotate(data[3],0,0,'',viz.BODY_ORI)
	#Apply pitch and roll to the head orientation
	viewpoint.rotate(0,data[4],data[5],'',viz.HEAD_ORI)
	#Navigate relative to body orientation
	if abs(y) > 0.2:
		viz.move(0,0,-y*0.1,viz.BODY_ORI)
	if abs(x) > 0.2:
		viz.move(x*0.1,0,0,viz.BODY_ORI)

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.001,viz.FOREVER)
This will restrict navigation to the x-z plane but still let the user look up and down.

Hope this helps!
Reply With Quote