PDA

View Full Version : How to pass only 1 axis of the position signal from the source to the dest in a LINK?


Zhi
04-03-2013, 11:20 AM
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:
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.