WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-15-2007, 04:07 PM
v-clizzin v-clizzin is offline
Member
 
Join Date: Sep 2006
Posts: 15
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)
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
Reply With Quote
  #2  
Old 08-15-2007, 05:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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)
This will rotate the bone in the avatars world coordinate frame.
Reply With Quote
  #3  
Old 08-16-2007, 04:23 PM
v-clizzin v-clizzin is offline
Member
 
Join Date: Sep 2006
Posts: 15
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!
Reply With Quote
  #4  
Old 08-16-2007, 06:10 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The viz.AVATAR_WORLD value is mentioned in the command reference for all the bone transform commands (i.e. bone.setEuler, bone.setQuat, etc...)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:53 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC