WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Difficulty with viewpoint when using 3 ppt lights (https://forum.worldviz.com/showthread.php?t=420)

Vbents 09-22-2005 03:12 PM

Difficulty with viewpoint when using 3 ppt lights
 
We are trying to use three lights--one for the user's head, and two which are connected to a baton held by the user--but we're having a lot of difficulty configuring the viewpoint so the baton in VR appears in the same place as the actual baton.

Has anyone else run into this problem, and is there some relevant code which we can look at? Thanks.

farshizzo 09-22-2005 04:14 PM

Hi,

I'm sorry, but I don't fully understand your problem. Are you having problems with the identity of the lights switching? Or, are you having problems with the accuracy of the lights? What specific symptoms are you expierencing?

Vbents 09-22-2005 04:31 PM

Sorry I'll make my question more clear.
We run the simulation with 3 lights, one for the head and 2 physically connected to each other. We want to draw a line between the two connected lights in VR-space to make a virtual "wand."
When we do this using absolute corodinates the wand works when you move it left, right, up, and down (if you're facing in the positive z-axis). However, when we move it in the z-axis it moves in the wrong direction. We tried negating the value at the z-axis but that didn't seem to help.

Sincerely,
Desperate-In-Stanford

farshizzo 09-22-2005 04:47 PM

Hi,

Would you mind posting the snippet of code you are using to draw the lines?

Also, keep in mind that the positive z-axis of the PPT system depends on the direction that the calibration board was facing when the PPT was last calibrated.

Also, which version of Vizard are you using? The reason I ask is that before version 2.53 there was a bug with On-The-Fly objects where the z-value of a vertex would be negated.

Vbents 09-22-2005 05:11 PM

Hey,
We're using 2.50c, so we'll see if using another version will help.
In the meanwhile, here's a code-snippit:

# Here we declare that the highest light in the beginning will be treated as the head for the entire program
pptLight1 = viz.add('vizppt.dls')
pptLight1.command(5,'',5)

pptLight2 = viz.add('vizppt.dls')
pptLight2.command(5,'',5)

pptLight3 = viz.add('vizppt.dls')
pptLight3.command(5,'',5)

if pptLight1.get()[1] < pptLight2.get()[1]:
temp = pptLight1
pptLight1 = pptLight2
pptLight2 = temp

if pptLight1.get()[1] < pptLight3.get()[1]:
temp = pptLight1
pptLight1 = pptLight3
pptLight3 = temp

And here we update the wand:

data1 = pptLight1.get()
data2 = pptLight2.get()
data3 = pptLight3.get()


wand.vertex(1,data3[0], data3[1], data3[2])
wand.vertexcolor(0,1,0,0)
wand.vertex(0,data2[0], data2[1], data2[2])
wand.vertexcolor(1,0,0,1)

Thanks

farshizzo 09-22-2005 05:21 PM

Hi,

Thanks for the sample code. Everything looks fine. So negating the z value of the vertex doesn't make a difference?

To get around the bug try the following instead:

1) Create a static wand with a vertex at the origin (0,0,0) and another vertex along the positive z axis (0,0,wandLength)

2) Instead of changing the vertex of the wand every frame, translate the wand to the position at one end, then have it look at the position on the other end:
Code:

wand.translate(data2)
wand.lookat(data3)

This method assumes that the length of the wand is fixed.


All times are GMT -7. The time now is 12:33 AM.

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