WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-27-2010, 01:17 PM
JimC JimC is offline
Member
 
Join Date: Jun 2009
Posts: 42
Question Navigation problem

Hi all,

I have a simple CAVE navigator: You point the tracked wand in the direction you want to fly and push the joystick forward. It's implemented by linking the following to the CaveView object:

Code:
class SyzygyNagivator(viz.VizNode,viz.EventClass):
  # __init__ omitted
  def onUpdate(self,e):
    currTime = time.clock()
    elapsed = currTime - self.lastTime
    if elapsed < .25:
      # Get joystick X,Z values and threshold them
      xMove = self.service.getAxis( self.xIndex )
      if abs(xMove) < .25:
        xMove = 0.
      zMove = self.service.getAxis( self.zIndex )
      if abs(zMove) < .25:
        zMove = 0.
      # Get wand orientation matrix
      rotMat = szg.ar_extractRotationMatrix( self.service.getMatrix( self.matIndex ) )
      # Compute rotated X, Z motion vectors
      xVec = rotMat * szg.arVector3(0,0,zMove)
      zVec = rotMat * szg.arVector3(xMove,0,0)
      # Add them
      vec = (xVec + zVec).toTuple()
      # Displace by motion vector
      currPos = gCaveView.getPosition()
      newPos = vizmat.MoveAlongVector( currPos, vec, elapsed*self.speed )
      self.setPosition( newPos )
    self.lastTime = currTime
...which works fine for flying around in empty space. The catch is that in e.g. gallery.py, when I collide with a well the stored position keeps incrementing as long as I hold the joystick forward, even though the collision detection is keeping the viewpoint from moving forward. In other words, the CaveView object's position does not reflect the action of the collision-handling algorithm. Of course, when you reverse direction, nothing happens until the stored position gets back inside the gallery. What's the right way to do this, i.e. where is there a position that reflects the collision detection?
Reply With Quote
 

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
Some Problem in navigation ssaha Vizard 3 03-24-2010 01:21 PM
Vertex shader performance problem Joran Vizard 2 11-17-2008 01:29 AM
navigation in cave environment Andy Vizard 4 03-28-2008 01:32 AM
5DT Data Glove 5 Ultra Problem bjgold Vizard 1 08-08-2006 04:08 PM
problem with female animations vmonkey Vizard 1 10-07-2005 10:36 AM


All times are GMT -7. The time now is 11:51 AM.


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