Thread: Reset Pitch?
View Single Post
  #2  
Old 01-18-2012, 11:40 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You should be able to use a single preEuler operator to reset the pitch to zero. The following sample code demonstrates how to reset the pitch during runtime. It will take the current raw euler values from the tracker and apply the inverse pitch to a preEuler operator.
Code:
import viz
import vizact
viz.go()

viz.add('maze.osgb')

tracker = viz.add('testtrack_ori.dls')
view_link = viz.link(tracker,viz.MainView)
pitch_reset = view_link.preEuler([0,0,0],target=viz.LINK_ORI_OP)

def ResetPitch():
	yaw,pitch,roll = tracker.getEuler()
	pitch_reset.setEuler([0,-pitch,0])

vizact.onkeydown('r',ResetPitch)
Reply With Quote