View Single Post
  #3  
Old 03-01-2011, 10:36 AM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
The project I'm working on is very large, but I'll try to post every snippet I can find...

Also, I don't believe I explained the problem very well, so let me try to concisely re describe. When we set walkSensitivity to anything other than 1, and we try to rotate in the virtual environment, it gets to a certain angle and then "snaps" to another position. Here is some code:

Code:
# init class
	fixedTracker = viz.addGroup()
	link = viz.link(fixedTracker, viz.MainView)
	def updateView():
		x,y,z = tracker.getPosition()
		fixedTracker.setPosition(x, 1.2, z)
		fixedTracker.setEuler(tracker.getEuler())
	vizact.ontimer(0, updateView)
# experiment class
self.link = link
# world rotation and origin shifting:
			# x,z are manually rotated because coordinate 
			# system varies between link and world
			theta = radians(-1.0*self.worldrotation)
			rotatedx = originxshift*cos(theta) - originzshift*sin(theta)
			rotatedz = originxshift*sin(theta) + originzshift*cos(theta)
			
			# These transformations are applied using matrix math.  This then
			# allows us to change the link
			
			# This pre-Trans corrects the mainView to be at the position of the goggle, not the InterSense module
			# 	It is moved 45 cm vertically in the y direction and 23 cm forward in the z direction
			self.link.preTrans([0,0.045,0.23]) 
			
			# This postTrans may be getting re-written later when we had the lateralShfit
			self.link.postTrans([-1.0*rotatedx,0,-1.0*rotatedz],viz.LINK_POS_OP)
			self.link.postEuler([-1.0*self.worldrotation,0,0],viz.LINK_ORI_OP)
			
			
			# Walk sensitivity is also applied as a scalar matrix transformation
			if self.walkSensitivityPre <= 0:
				self.link.postScale([self.walkSensitivity,1,self.walkSensitivity],viz.LINK_POS_OP)
			else:
				self.link.postScale([self.walkSensitivityPre,1,self.walkSensitivityPre],viz.LINK_POS_OP)
				
			eyemodification = 0.0
			# Set the eyeheight
			viz.eyeheight(0.0)
		
			
			#lateralshift
			# Now apply the lateralShift as a transformation on the link
			# I'm not sure if this overwriters the previous postTransformation we define using the world rotation
			self.lateralShiftLink = self.link.postTrans([self.totalLateralShift,0,0])
Reply With Quote