View Single Post
  #1  
Old 06-21-2014, 11:44 PM
agrima agrima is offline
Member
 
Join Date: Jun 2014
Posts: 4
Question animate an object using 5dt data glove 5 ultra

hi;

I have to animate i.e, control the motion of an object using data glove.
I tried grabbing the object , but now i dont know how should i try moving the object in accordance to my glove. I am posting the code below:

import viz
import vizcam
import vizact
import random
import hand

viz.go()
viz.setMultiSample(4)
viz.fov(60)
#viz.go(viz.QUAD_BUFFER)
#viz.go(viz.HALF_RESOLUTION)

PORT_5DT_USB = 0
sensor = viz.addSensor('5dt.dls')
glove = hand.add(sensor,hand.GLOVE_5DT)


vase = viz.add('vase.ive')
vase.setPosition(-160,40,-30)


models={'9.ive'}
model1=viz.add('9.ive')

viz.MainView.setPosition(-160,50,130)
viz.MainView.setEuler(180,00,0)





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 getGesture():
gesture = int(sensor.get()[-1])


if gesture == 7:
#three finger
viz.MainView.setPosition([0,0,0.05],viz.REL_PARENT)
if gesture == 8:
#Little finger point
viz.MainView.setPosition([-0.05,0.0,0],viz.REL_PARENT)
if gesture == 9:
#Little finger and index point
viz.MainView.setPosition([0.05,0.0,0],viz.REL_PARENT)
if gesture == 3:
#two finger point
viz.MainView.setPosition([0,0.0,-0.05],viz.REL_PARENT)
if gesture == 1:
#Index finger point
viz.MainView.setPosition([0,.05,0], viz.REL_PARENT)
if gesture == 0:
#Fist
#vase.setPosition([0,-.05,0], viz.REL_PARENT)
viz.MainView.setPosition([0,-.05,0], viz.REL_PARENT)
if gesture == 14:
viz.link(glove,vase)
viz.grab(glove,vase)


vizact.ontimer(0, getGesture)
Reply With Quote