WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-20-2008, 02:45 AM
Andy Andy is offline
Member
 
Join Date: Mar 2008
Location: Germany
Posts: 36
navigation in cave environment

I have a problem by understanding a cave-configuration and navigation respectively. I hope somebody can help me. In my configuration I have one wall (stereo render by two clients), one Polhemus-Fastrak for Head-Tracking and my Keybord for navigation. My Problem is: who can I navigate through my VR-World?

I see a cave-wall like a window by which I see through. Now, when I would like to navigate through my VR-World, in my opinion I have two options: first I can move the Wall an my Viewpoint or second I move the whole world (and my Body\Head is the central point).

Who can I do this with Vizard?

Code:
import viz
import vizcave
import viztracker

viz.go()
viz.MainWindow.stereo(viz.STEREO_RIGHT)

viz.pushmask(viz.CLIENT1)
viz.MainWindow.stereo(viz.STEREO_RIGHT)
viz.popmask()

viz.pushmask(viz.CLIENT2)
viz.MainWindow.stereo(viz.STEREO_LEFT)
viz.popmask()

c0 = -1,2,0
c1 = 1.,2,0
c2 = 1.,0.6,0
c3 = -1,0.6,0
vp = [0, 1.2, -1.6]
vr = [0,0,0]

cave = vizcave.Cave()

#Add a sensor.
tracker = viz.add('fastrak.dls')

FrontWall = vizcave.Wall(upperLeft=c0,upperRight=c1,lowerLeft= c3,lowerRight=c2,name='Front Wall' )
cave.addWall(FrontWall, mask =None, window = viz.MainWindow)

def drawWall():
	viz.startlayer(viz.LINE_STRIP)
	viz.vertex(c0)
	viz.vertex(c1)
	viz.vertex(c2)
	viz.vertex(c3)
	viz.vertex(c0)
	viz.vertexcolor(1,1,0.1)
	viz.startlayer(viz.LINES)
	viz.vertex(c0)
	viz.vertex(vp)
	viz.vertex(c1)
	viz.vertex(vp)
	viz.vertex(c2)
	viz.vertex(vp)
	viz.vertex(c3)
	viz.vertex(vp)
	wall_frame = viz.endlayer()

def UpdateCave():
	# Key's for offsetting my Tracking-data (Position)
	if viz.key.isDown('j'):
		vp[0] -= 1*viz.elapsed()
	if viz.key.isDown('u'):
		vp[0] += 1*viz.elapsed()
	if viz.key.isDown('k'):
		vp[1] -= 1*viz.elapsed()
	if viz.key.isDown('i'):
		vp[1] += 1*viz.elapsed()
	if viz.key.isDown('l'):
		vp[2] -= 0.5*viz.elapsed()
	if viz.key.isDown('o'):
		vp[2] += 0.5*viz.elapsed()
	# Key's for offsetting my Tracking-data (Orientation)
	if viz.key.isDown('f'):
		vr[0] -= 0.5
	if viz.key.isDown('r'):
		vr[0] += 0.5
	if viz.key.isDown('g'):
		vr[1] -= 0.5
	if viz.key.isDown('t'):
		vr[1] += 0.5
	if viz.key.isDown('h'):
		vr[2] -= 0.5
	if viz.key.isDown('z'):
		vr[2] += 0.5
	
	TP = tracker.getPosition()
	TO = tracker.getEuler()
	NewTO = vizmat.EulerToQuat((vr[0]+TO[1]),(vr[1]+TO[0]),(vr[2]+TO[2])) #swap X-Y and transform in quaternion
	NewTP = [(vp[0]*-1)+TP[0],vp[1]+(TP[1]*-1),vp[2]+(TP[2]*-1)]
	cave.update(pos = NewTP,ori =NewTO)
	viz.MainView.translate(NewTP)
	
	print "Tracker_P: ", (NewTP)
	print "Tracker_O: ", NewTO
	print "MV_P: ", viz.MainView.getPosition()
	print "MV_O: ", viz.MainView.getEuler()
	
vizact.ontimer(0,UpdateCave)
viz.add('tut_ground.wrl')
mini = viz.add("mini.osgx")
mini.translate(0,0.7,0)
mini.setScale(0.3, 0.3, 0.3)
mini.add(vizact.spin(0,1,0,15))
drawWall()

viz.starttimer(0,0.01,viz.FOREVER)
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
Problems implementing Vizard in a CAVE with Shutter Glasses shivanangel Vizard 7 05-20-2009 11:47 AM
data glove navigation arielasso Vizard 6 10-24-2007 02:15 PM
environment maps, scenes, and you! vadrian Vizard 1 01-12-2005 04:04 PM
Basic Joystick Navigation Question Plasma Vizard 2 01-29-2004 07:08 PM
Navigation Speed/Too Slow Plasma Vizard 2 01-28-2004 11:07 AM


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


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