#1
|
|||
|
|||
euler problems in Vizard 3.0
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) Thank you! Christopher Lin |
#2
|
|||
|
|||
The default behavior when setting the euler of a bone, is to set it in its local coordinate system. Since the head bone is the child of other bones, its local coordinate system does not match up with the world coordinate system. If you want to rotate the head bone in world coordinates, try the following:
Code:
head.setEuler(euler,viz.AVATAR_WORLD) |
#3
|
|||
|
|||
Great, thanks a lot! That worked just fine.
By the way, is there a list of the viz module's constants with descriptions of what they do, particularly for the constants that have to do with the types of coordinate systems? (I hadn't heard of viz.AVATAR_WORLD before now.) I've looked through the documentation, but can only find lists of methods/functions. Thanks! |
#4
|
|||
|
|||
The viz.AVATAR_WORLD value is mentioned in the command reference for all the bone transform commands (i.e. bone.setEuler, bone.setQuat, etc...)
|
|
|