Yes sensor has both position and orientation (IS-900).
I am trying to run this on update so that I can use the euler information to determine which directions to apply the translation. When I use preTrans the view flies off in one direction.
I have tried subtracting the translation values from the preceding preTrans call, but that results in an accumulative translation error over time. I have also tried reseting each time before applying the preTrans. Both are commented out below. Thanks.
Code:
import viz
import viztask
import math
viz.go(viz.HMD | viz.STEREO)
isense = viz.add('intersense.dle')
track = isense.addTracker()
main = viz.link(track,viz.MainView)
def mainLoop():
yield viztask.waitKeyDown(' ')
#Do Stuff
xOffOld=0.0
zOffOld=0.0
hmdLength = .29
def setViewTrackCorrection():
global xOffOld,zOffOld
#main.reset(viz.HEAD_POS)
eul = main.getEuler()
xOff = hmdLength*math.sin(math.radians(eul[0]))
zOff = hmdLength*math.cos(math.radians(eul[0]))
#main.postTrans([-xOffOld+xOff,0,-zOffOld+zOff])
main.preTrans([xOff,0,zOff])
xOffOld = xOff
zOffOld = zOff
vizact.onupdate(1,setViewTrackCorrection)
viztask.schedule(mainLoop())