WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   How to pass only 1 axis of the position signal from the source to the dest in a LINK? (https://forum.worldviz.com/showthread.php?t=4544)

Zhi 04-03-2013 11:20 AM

How to pass only 1 axis of the position signal from the source to the dest in a LINK?
 
Hi all,

I know that in a LINK, one can set the MASK of of the LINK to pass only the orientation, only the position, or both from the source node to the destination node. My question is whether there is a way to pass only one axis (e.g. only X axis) of the position signal from the source to the destination.

In our case, the source is the head tracker and the destination is the viz.mainView. We want to pass the orientation signal and only the x axis of the position signal to the viz.mainView, so that the tracker signal won't affect the y position and the z position of the viz.mainView. Is there a simple way to do this?

Thanks in advance!
Zhi

Jeff 04-03-2013 03:37 PM

Yes, you can get the position and orientation of the tracker each frame and apply whichever parts of that you want:
Code:

import viz
import vizact
import vizcam
viz.go()

dojo = viz.addChild('dojo.osgb')

keyTracker = vizcam.addKeyboard6DOF()

def updateView():
        pos = keyTracker.getPosition()
        ori = keyTracker.getEuler()
       
        viz.MainView.setPosition([pos[0],1.8,0])
        viz.MainView.setEuler(ori)
       
vizact.onupdate(0,updateView)


Zhi 04-04-2013 07:28 AM

Cool, Jeff. So I don't need to use LINK at all. Thank you for your suggestion. I will try that.


All times are GMT -7. The time now is 12:44 PM.

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