WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 02-25-2011, 12:32 PM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
Scaling movement through the virtual environment

Hello,

I am working on an experiment that requires relative motion through the environment to change under different conditions. However, it seems that when I try scaling the motion, it messes up rotation. When I turn to a certain point, it moves back several degrees. Also, when I set the scaling higher, forward motion is noticeably offset.

This is what I'm using to change the relative motion:
Code:
self.link.postScale([self.walkSensitivity,1,self.walkSensitivity],viz.LINK_POS_OP)
There are several other operations being applied on self.link, but the problem only seems to occur when this line is in place.

Any suggestions are appreciated.

Thanks,
miles.
Reply With Quote
  #2  
Old 02-25-2011, 03:29 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you post all the code related to the link and the other operations?
Reply With Quote
  #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
  #4  
Old 03-02-2011, 01:06 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
To keep your postTrans from getting scaled by the later postScale, create the postScale first or change its priority argument. The order you create the pre/post operations matters.

Not sure what you mean by
Quote:
When I turn to a certain point, it moves back several degrees.
or how to fix it. Can you provide more description there?
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #5  
Old 03-09-2011, 08:41 AM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
When the subject turns his/her body, the degree of rotation in the real world does not match the degree of rotation in the virtual world. At a certain degree of rotation, the rotation in the virtual world instantly shifts several degrees forward or backward.

Example Scenario:
Facing Forward, 90 degrees in the virtual and real world
Begin Rotating Clockwise, 90... 75... 60... 45...
Reach 45 degrees, virtual world jumps back to 60 degrees
Continue Rotating Clockwise, 60... 45... 30... 15... 0
Halt, Now facing 0 degrees in virtual environment
Rotate Counter Clockwise, 0... 15... ... 60
Reach 60 degrees, virtual world jumps back to 45 degrees
Continue Rotating Counter Clockwise, 45... 60... 75... 90
Halt, Facing Forward in both real and virtual worlds

Thanks for your assistance.
Reply With Quote
  #6  
Old 03-12-2011, 10:48 AM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Your description is good, but I don't know why you would see that.

If I was you, I would re-write the movement code using vizmat.Transform or with a system of 3D nodes with parent/child relationships. That way we can see what is going on and not have all that action buried in a link object.

Probably not what you want to hear. Hopefully I'm just missing something.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #7  
Old 03-23-2011, 06:45 AM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
Thank you for the response. I did not write the original transformation code, so I don't fully understand it. I'll continue to play around with it, hopefully I can understand it better.

Anyone else have any ideas?
Reply With Quote
  #8  
Old 03-23-2011, 08:55 AM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
It appears the only relevant lines are
Code:
			# 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)
I've commented out all other matrix operations and the problem still occurs. Perhaps I am using the wrong operator. How would one go about scaling motion in the virtual environment? For instance, if I walked one meter in the real world, how could I walk 2m in the virtual world?
Reply With Quote
  #9  
Old 03-23-2011, 09:03 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You are using the <link>.postScale() command incorrectly. If you look at the docs, the target option is the third parameter, not the second. I recommend passing the value as a keyword argument:
Code:
self.link.postScale([self.walkSensitivity,1,self.walkSensitivity],target=viz.LINK_POS_OP)
Reply With Quote
  #10  
Old 03-24-2011, 12:26 PM
miles miles is offline
Member
 
Join Date: Jan 2011
Posts: 21
Wow! I cannot thank you enough, what a silly mistake! It has been baffling our team for weeks, I can't believe it was so simple. It works fully now, please mark as solved. Our team extends warmest thanks.

-miles
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Real environment with virtual objects do interact CRI Vizard 4 05-27-2010 12:05 PM
Open Position: Virtual Environment Programmer aarset Announcements 0 05-31-2009 07:23 AM
Question about input from virtual keyboard. yyang Vizard 4 12-23-2008 12:25 PM
Getting a mirror to work in any environment Frank Verberne Vizard 5 03-27-2008 08:21 AM
Human FOV and VIrtual FOV giancamati Vizard 0 12-14-2006 03:33 AM


All times are GMT -7. The time now is 12:30 PM.


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