#1
|
|||
|
|||
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) |
#2
|
|||
|
|||
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? |
#3
|
|||
|
|||
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. |
#4
|
|||
|
|||
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.
|
#5
|
|||
|
|||
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) |
#6
|
|||
|
|||
Yes, that was what was done before. However, how could we extend the same functionality to a .wrl object?
|
#7
|
|||
|
|||
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. |
#8
|
|||
|
|||
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 } } ] } ] } |
#9
|
|||
|
|||
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 } } ] } |
Thread Tools | |
Display Modes | Rate This Thread |
|
|