WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 03-12-2014, 06:15 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You could link the viewpoint orientation to the head tracker:
Code:
viz.link(headTracker,viz.MainView,mask=viz.LINK_ORI)
Then calculate the change in x, z position every frame based on body tracker yaw and joystick data and set the viewpoint position:
Code:
viz.MainView.setPosition([x,0,z],viz.REL_GLOBAL)
Or you could set the viewpoint body orientation so position movements are relative to that and then adjust the final viewpoint orientation:
Code:
MOVE_SPEED = 5

def updateViewpoint():
	
	x,y,z = joy.getPosition()
	move_amount = MOVE_SPEED * viz.getFrameElapsed()
	viz.MainView.move([x*move_amount,0,y*move_amount], viz.BODY_ORI)
		
	headOri = headTracker.getEuler()
	bodyOri = bodyTracker.getEuler()
	viz.MainView.setEuler([bodyOri[0],0,0],viz.BODY_ORI)
	viz.MainView.setEuler([headOri[0] - bodyOri[0],headOri[1],headOri[2]])
		
vizact.onupdate(0,updateViewpoint)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:18 PM.


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