View Single Post
  #3  
Old 10-24-2007, 11:56 AM
arielasso arielasso is offline
Member
 
Join Date: Sep 2007
Posts: 8
thank you.now i face the new problem.why the hand picture did not follow the view. i create the hand object.but it static.i want it follow the view.can you help me?!..or i can't do that request?..
i more problem how can i turn left/right for the view?...u can suggest any gesture..
anywhere i want to say thank you very2 much for helping me...
may god bless u sir..
can u help me again..
thanks a lot..

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
glove = hand.add(sensor,hand.GLOVE_5DT)

##Place the hand in front of the user
glove.rotate(0,-45,0)
viz.MainView.translate(0,0.3,-0.4)
glove.setPosition( 0.03, 0.09, 0.5 )

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



#Add an array with all the gesture names from the 5DT user's manual.
gestureName = ['Fist', 'Index finger point', 'Middle finger point', 
'Two finger point', 'Ring finger point', 'Ring-Index finger point', 
'Ring-middle finger point', 'Three finger point', 'Little finger point', 
'Index and little finger point', 'Little-middle finger point', 
'Not ring finger point', 'Little-ring finger point', 
'Not middle finger point', 'Not index finger point', 
'Flat hand', 'Undefined']

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