WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 06-26-2009, 02:03 PM
Feuereissen Feuereissen is offline
Member
 
Join Date: Jun 2009
Posts: 8
Eliminate Sideways Motion when colliding w/Objects

Hi all,

I was wondering how to stop moving sideways when one backs up in a 3D environment and hits a wall. I am working with a VR environment in which users move about using a joystick or the PPT Tracking system. The World has been set up so that a transparent, circular wall has been set around the scene for users not to leave the bounds of the world we want to present. Every time the user backs up and hits the wall a slight sideways motion changes the position of the camera in the 3D world. Is there a elegant and quick way to detect the collision for that particular wall and inhibit this sidway motion?
Great, if anyone knows!

Cheers,

Dan
Reply With Quote
  #2  
Old 06-26-2009, 08:08 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Assuming you are doing collision detection with the "collision(viz.ON)" function, you could wait for a viz.COLLISION_EVENT notification.
Code:
def onCollision(info):
    print 'Collided with object',info.object
    #stop view until joystick impulse direction vector points over 90 degrees 
    #away from info.normal

viz.callback(viz.COLLISION_EVENT, onCollision)
You know your needs better of course, but why not just let the user zero the joystick if they don't like moving around the circle? Perhaps you want is to create a "dead zone" for the joystick input. So if input is less than .05 away from zero, then impulse is 0.
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #3  
Old 06-26-2009, 08:28 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Just though of another way to stop sideways motion. Check every frame if the view has moved in any direction other than forward or back.
Code:
#sudo code

#every frame
displacementVector = currentViewPosVector - lastViewPosVector
headingDisplacementVector  = vizmat.LookToQuat(displacementVector))
viewDisplacementHeadingDiff = vizmat.QuatDiff(headingDisplacementVector, viz.MainView.getQuat())
if viewDisplacementHeadingDiff != 0 or viewDisplacementHeadingDiff != 180:
    viz.MainView.setPosition(lastViewPos) #stop
__________________
Paul Elliott
WorldViz LLC
Reply With Quote
  #4  
Old 07-09-2009, 01:43 PM
Feuereissen Feuereissen is offline
Member
 
Join Date: Jun 2009
Posts: 8
Hey, Gladsomebeast, thanks alot for your input! I think im on the right track now...
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


All times are GMT -7. The time now is 01:59 AM.


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