View Single Post
  #4  
Old 10-24-2007, 12:30 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here's a modified version of the script that will always place the glove in front of the user. You can use other gestures to control left/right movement. Or, if you have an orientation tracker device, such as the Intersense IneriaCube, you could use that to steer the viewpoint as well.
Code:
import viz
import hand
viz.go()

#Identify the data glove's port.
PORT_5DT = 1

#Add the 5DT sensor
sensor = viz.add('5dt.dls')

##Create a hand object from the data glove
overlayView = viz.addView()
overlayView.setScene(4)
overlay = viz.addWindow(pos=(0,1),size=(1,1),clearMask=viz.GL_DEPTH_BUFFER_BIT,view=overlayView)
glove = hand.add(sensor,hand.GLOVE_5DT,scene=4,pos=(0,1.5,1.5),euler=(0,-90,0))

#Initialize world
viz.clearcolor( viz.GRAY )
ground = viz.add( 'tut_ground.wrl' )

def UpdateView():
	gesture = glove.getGesture()
	
	if gesture == hand.GESTURE_INDEX_FINGER:
		#Index finger point
		viz.MainView.move( 0, 0, 1*viz.elapsed())
	elif gesture == hand.GESTURE_FIST:
		#Fist
		viz.MainView.move( 0, 0, -1*viz.elapsed())
	
		
vizact.ontimer(0,UpdateView)
Reply With Quote