WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-22-2005, 03:12 PM
Vbents Vbents is offline
Member
 
Join Date: Sep 2005
Posts: 25
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.
Reply With Quote
  #2  
Old 09-22-2005, 04:14 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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?
Reply With Quote
  #3  
Old 09-22-2005, 04:31 PM
Vbents Vbents is offline
Member
 
Join Date: Sep 2005
Posts: 25
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
Reply With Quote
  #4  
Old 09-22-2005, 04:47 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
  #5  
Old 09-22-2005, 05:11 PM
Vbents Vbents is offline
Member
 
Join Date: Sep 2005
Posts: 25
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
Reply With Quote
  #6  
Old 09-22-2005, 05:21 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
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 11:07 AM.


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