Vizard 8 » Tutorials & Examples » Example scripts » Input Devices » Data glove
8.0

Data glove

This script demonstrates how to use a 5DT data glove.

import viz
import vizact
import vizshape

viz.setMultiSample(4)
viz.fov(60)
viz.go()

PORT_5DT_USB = 0
sensor = viz.add('5dt.dls')

import hand
h = hand.add(sensor)
h.setEuler(0,-90,0)
#h.leftHand()

tips = []
for x in range(5):
    tips.append( vizshape.addSphere(radius=0.001,color=viz.BLUE) )

def UpdateFingerTips():
    for x,tip in enumerate(tips):
        mat = h.getFingerTip(x)
        tip.setPosition(mat.getPosition())
        tip.setQuat(mat.getQuat())
    
vizact.ontimer(0,UpdateFingerTips)

import vizcam
cam = vizcam.PivotNavigate()
cam.setCenter(0,0,0)
cam.setDistance(0.3)

viz.clearcolor(viz.GRAY)