#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
When viewpoint collision is enabled a collision event will be generated when the viewpoint collides with an object. Information about the collision, including position, is available.
Code:
import viz viz.go() gallery = viz.add('gallery.ive') viz.collision(viz.ON) def onCollision(info): print 'Collided at point',info.point viz.callback(viz.COLLISION_EVENT, onCollision) |
#3
|
|||
|
|||
Actually, I am using the CaveView. The problem is the the collision callback even only works 50% of the time. I hit a wall, and sometimes it shows up, then the next time it won't. Changing the step size seems to help a bit, but not enough for a user not to get stuck on a regular basis.
|
#4
|
|||
|
|||
The collision detection works as expected with a simple vizcave example. Try adding collision detection to the script on the following page and just move the viewpoint with arrow keys:
http://docs.worldviz.com/vizard/#vizcave_powerwall.htm Perhaps other code in your script is interfering with the viewpoint movement or collision code. Can you post a simple example that reproduces the issue? |
|
|
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 |