WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Virtual arrow with multiple tracking lights (https://forum.worldviz.com/showthread.php?t=425)

Vmichaeljin 09-27-2005 03:16 PM

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)

farshizzo 09-27-2005 03:23 PM

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?

Vmichaeljin 09-27-2005 03:40 PM

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.

Vmichaeljin 09-27-2005 03:41 PM

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.

farshizzo 09-27-2005 03:52 PM

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)


Vmichaeljin 09-27-2005 06:24 PM

Yes, that was what was done before. However, how could we extend the same functionality to a .wrl object?

farshizzo 09-27-2005 06:36 PM

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.

Vmichaeljin 10-02-2005 10:53 PM

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 }
}
] }
]
}

farshizzo 10-03-2005 08:53 AM

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 }
}
]
}



All times are GMT -7. The time now is 04:15 AM.

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