Hi, I am running the following code in Vizard, and setting an avatar's head to follow the tracked euler does not work.
Code:
import viz
viz.go(viz.HMD + viz.STEREO + viz.TRACKER)
PORT_INTERSENSE = 3
# set up tracking
if viz.get(viz.TRACKER):
headIsense = viz.add('intersense.dls')
ppt = viz.add('vizppt.dls')
ppt.command(5,'',5) #Average over 5 samples
#Automatically track head position and orientation
viz.tracker()
avatar = viz.addAvatar('Male.cfg')
head = avatar.getBone('skel_Head')
head.lock()
def mytimer(num):
#Rotate head
euler = viz.get(viz.HEAD_EULER)
head.setEuler(euler[2],euler[0],euler[1]) # works correctly, despite moving euler element indices!
#head.setEuler(euler[0],euler[1],euler[2]) # does not work correctly!
viz.callback(viz.TIMER_EVENT, mytimer)
viz.starttimer(1,0.01,viz.FOREVER)
As you can see above, I have to move the indices of the euler elements one over to the right in order to get the avatar's head to rotate correctly. This is confusing, because the Vizard documentation says that both viz.get(viz.HEAD_EULER) and node3d.setEuler() order euler elements as [yaw, pitch, roll]. I'd appreciate advice on whether there's been some upgrade of Vizard I need to download. I'm currently running version 3.00.2051.
Thank you!
Christopher Lin