WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-27-2005, 03:16 PM
Vmichaeljin Vmichaeljin is offline
Member
 
Join Date: Sep 2005
Posts: 6
Virtual arrow with multiple tracking lights

I'm trying to represent a virtual arrow by using two PPT lights.

I linked one light to the arrow object to handle translation. Then I had the arrow object "lookat" the second light. While translation seems correct, orientation is off. I would appreciate some assistance.

My relevant code:

wand = viz.add('rod.wrl')
wand.link(pptLight2)

---------

data3 = pptLight3.get()
wand.lookat(data3)
Reply With Quote
  #2  
Old 09-27-2005, 03:23 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

What do you mean by "orientation is off"? Is your "rod.wrl" model pointing along the positive z-axis? Are you sure that the identities of pptLight2 and pptLight3 are not swapping?
Reply With Quote
  #3  
Old 09-27-2005, 03:40 PM
Vmichaeljin Vmichaeljin is offline
Member
 
Join Date: Sep 2005
Posts: 6
I'm not sure how to explain it. All I know is that the rod starts pointing up vertically, even though the lights are horizontally spaced at ground level. Physical rotation does not correspond to virtual, and the rod resists rotation away from the vertical axis.

It would help if you had code that took data from two trackers and rendered an object's position and orientation in a way that made sense for an object like a sword, arm, etc.
Reply With Quote
  #4  
Old 09-27-2005, 03:41 PM
Vmichaeljin Vmichaeljin is offline
Member
 
Join Date: Sep 2005
Posts: 6
No, I don't think swapping is the issue, as the orientation would simply be reversed in that case, which is not a big deal right now.
Reply With Quote
  #5  
Old 09-27-2005, 03:52 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I just ran the following script and it works fine on the system here. Can you try it out and let me know if you have problems with it. Also, are you calling the reset() command on the ppt sensors?
Code:
import viz
viz.go()

ppt1 = viz.add('vizppt.dls')
ppt2 = viz.add('vizppt.dls')

viz.startlayer(viz.LINES)
viz.linewidth(3)
viz.vertexcolor(viz.RED)
viz.vertex(0,0,0)
viz.vertex(0,0,1)
rod = viz.endlayer()

viz.clearcolor(viz.GRAY)
viz.move(0,0,-5)
viz.add('tut_ground.wrl')

def ontimer(num):
	rod.translate(ppt1.get())
	rod.lookat(ppt2.get())

viz.callback(viz.TIMER_EVENT,ontimer)
viz.starttimer(0,0,viz.FOREVER)
Reply With Quote
  #6  
Old 09-27-2005, 06:24 PM
Vmichaeljin Vmichaeljin is offline
Member
 
Join Date: Sep 2005
Posts: 6
Yes, that was what was done before. However, how could we extend the same functionality to a .wrl object?
Reply With Quote
  #7  
Old 09-27-2005, 06:36 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

You don't need to change anything to get it working with wrl objects. As long as the wrl object is centered at the origin and extends along the +z axis it should work fine.
Reply With Quote
  #8  
Old 10-02-2005, 10:53 PM
Vmichaeljin Vmichaeljin is offline
Member
 
Join Date: Sep 2005
Posts: 6
Thanks, I think it was a problem with the .wrl's initial settings. How can I change the following so that the rod is centered and faces north?

#VRML V2.0 utf8

# Produced by 3D Studio MAX VRML97 exporter, Version 3, Revision 1.31
# Date: Mon Aug 14 20:59:35 2000

DEF Cylinder02 Transform {
translation 0 0 0
rotation 0 0 1 -1.57
children [
Transform {
translation 0 2.5 0
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.3451 0.6941 0.102
}
}
geometry Cylinder { radius 0.1 height 5 }
}
] }
]
}
Reply With Quote
  #9  
Old 10-03-2005, 08:53 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The following should create a cylinder pointing along the +z axis:
Code:
#VRML V2.0 utf8

# Produced by 3D Studio MAX VRML97 exporter, Version 3, Revision 1.31
# Date: Mon Aug 14 20:59:35 2000

DEF Cylinder02 Transform {
translation 0 0 -2.5
rotation 1 0 0 -1.57
children [
Shape {
appearance Appearance {
material Material {
diffuseColor 0.3451 0.6941 0.102
}
}
geometry Cylinder { radius 0.1 height 5 }
}
]
}
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 01:38 PM.


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