| 
		
	
		
		
		
		 
			
			# I just tried and get this work well: orientation & position for one of those 4 # sensers.  (try to link View with just one Sensor, each try works.) 
# Now I'm trying to use sensor 1 to control orientation& position 
 
# and using sensor 2 to replace mouse 
# sensor 3 & 4 replace left hand and right hand 
# for sensor 2,3,4, could you give me any idea ? thanks 
 
import viz 
import viztracker 
viz.go() 
viz.clearcolor(viz.BLUE) 
gallery = viz.add('gallery.ive') 
view = viz.get(viz.MAIN_VIEWPOINT) 
#tracker = sensor.addTracker()###error 
#viz.tracker() 
PORT_INTERSENSE = 1 
sensor1 = viz.add('intersense.dls') 
PORT_INTERSENSE = 2 
sensor2 = viz.add('intersense.dls') 
PORT_INTERSENSE = 3 
sensor3 = viz.add('intersense.dls') 
PORT_INTERSENSE = 4 
sensor4 = viz.add('intersense.dls') 
# link which sensor, which sensor will  
# control the view orientation and walk position 
S = sensor1 
link = viz.link( S, view )#link the senser to view: perform orientation and #position with head tracker 
 
def ontimer(num): 
	#the original pos and euler are [0.0, 0.0, 0.0] 
	pos = S.getPosition() 
	euler = S.getEuler() 
	print pos 
	print euler 
	viz.MainView.setPosition(pos[0]*10,pos[1]+1.82,pos[2]*10) 
	viz.MainView.setEuler(euler[0],euler[1],euler[2])	 
	 
viz.callback(viz.TIMER_EVENT, ontimer) 
viz.starttimer(0, 0.01, viz.FOREVER)
		 
		
		
		
		
		
		
		
		
			
			
			
			
				 
			
			
			
			
			
			
			
				
			
			
			
		 
	
	 |