WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Precision Position Tracker (PPT) (https://forum.worldviz.com/forumdisplay.php?f=9)
-   -   Moving main viewpoint when linked to PPT (https://forum.worldviz.com/showthread.php?t=2707)

v-clizzin 04-19-2010 02:50 PM

Moving main viewpoint when linked to PPT
 
I'm currently debugging an old falling-into-a-pit demo; the problem is that the viewpoint does not actually move downwards when the user 'falls' into the pit.

I initially set up PPT tracking like so:

Code:

vrpn = viz.add('vrpn7.dle')
ppt = vrpn.addTracker('PPT0@' + PPT_HOSTNAME)
filter = viz.add("filter.dle")
ppt = filter.average(ppt, samples = 5)

view = viz.MainView
link = viz.link(ppt, view)
link.reset(viz.RESET_X|viz.RESET_Y|viz.RESET_Z)
viz.eyeheight(0.0)

The code for moving the viewpoint downward is:

Code:

fallV -= 9.8 * viz.elapsed() # fallV is initialised at 0 when the fall begins
viz.translate(viz.HEAD_POS,0,fallV*viz.elapsed(),0)

However, the viewpoint does not move downward. I do know from print statements that fallV is being updated correctly. I've tried using link.setPos(ppt.getPosition()[0], ppt.getPosition()[1] + fallV, ppt.getPosition()[2]), but that simply makes the view jump to floor level height and does not move further down thereafter. Perhaps I don't fully understand the interaction between PPT, the main viewpoint, and the link between the two.

This may also have something to do with the fact that this demo was written during our serial PPT days, and the update to make it work with VRPN may not have ironed out all the kinks.

Any ideas? Thank you!

Jeff 04-20-2010 04:09 PM

When the viewpoint is linked to the tracker trying to set it's position will not have any effect. In your timer function that moves the view down you could do something like:
Code:

link.reset(viz.RESET_OPERATORS)
link.postTrans([0,fallV,0])

then when you want to move the view back up you would use:
Code:

link.reset(viz.RESET_OPERATORS)


All times are GMT -7. The time now is 11:24 PM.

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