View Single Post
  #7  
Old 05-02-2012, 03:50 PM
Gladsomebeast Gladsomebeast is offline
Member
 
Join Date: Mar 2005
Location: Isla Vizta, CA
Posts: 397
Hi Victor,

I'm betting we simply need to get the wall definitions and kinect tracker coordinates working nicely together. Trust vizcave. When things shrink on the walls, this should be compensated for by the user's eyes getting closer to the screen.

Lets setup a third person view of the scene. We will add a 3d model to represent the user's head position. The cave.drawWalls() function will come in handy to show our wall definitions. When we have this setup, we test by having the user stand in known physical locations and checking that our virtual 3rd person view shows the users representation in the correct position relative to the walls.

I suspect that the problem will come from the offset you do to the Kinect data. We'll need to figure out the postTrans and possibly postEuler so that when people stand in the middle of the cave the viewtracker.getPosition command should return [0, high of person, 0].

Here is some code that does a third person view for the powerwall example script:


Code:
import viz
import vizcave
import viztracker

#Dimension of PowerWall in meters
WIDTH       = 3.0
HEIGHT      = 3.0
DISTANCE    = 2.0

#Initialize graphics window
viz.go()

#Create single power wall
PowerWall = vizcave.Wall(   upperLeft=(-WIDTH/2.0,HEIGHT,DISTANCE),
                            upperRight=(WIDTH/2.0,HEIGHT,DISTANCE),
                            lowerLeft=(-WIDTH/2.0,0.0,DISTANCE),
                            lowerRight=(WIDTH/2.0,0.0,DISTANCE),
                            name='Power Wall' )

#Create cave object with power wall
cave = vizcave.Cave()
cave.addWall(PowerWall)
cave.drawWalls()

#Create tracker object using the keyboard (WASD keys control the viewpoint, the user's eye location)
#Make the starting location for the user's eye above origin
viewtracker = viztracker.KeyboardPos()
viewtracker.setPosition(0.0,1.8,0)

#Pass the viewpoint tracker into the cave object so it can be automatically updated
cave.setTracker(pos=viewtracker)

#visualize tracker
eyeTrackerRepresentation = viz.add('biohead_eyes.vzf')
viz.link(viewtracker, eyeTrackerRepresentation)


#Create CaveView object for manipulating the entire cave environment
#The caveorigin is a node that can be adjusted to move the entire cave around the virtual environment
caveorigin = vizcave.CaveView(viewtracker)

#XXX don't work with cave.drawWalls()
#Create another tracker using the keyboard and mouse (arrow keys adjust position, mouse changes orientation)
#origintracker = viztracker.KeyboardMouse6DOF()
##Link the keyboard/mouse so that it moves the cave and user around the virtual environment
#originlink = viz.link (origintracker, caveorigin)


#Add gallery environment model
viz.add('gallery.ive')


BirdEyeWindow = viz.addWindow()
BirdEyeWindow.fov(60)
BirdEyeWindow.setPosition([0,1])
BirdEyeWindow.setSize(.5, .5)
BirdEyeView = viz.addView()
BirdEyeWindow.setView(BirdEyeView)
BirdEyeView.setPosition([0,6,0])
BirdEyeView.setEuler([0,90,0])


#only show eyeTrackerRepresentation in 3rd person view
thirdPersonMask = viz.addNodeMask()
eyeTrackerRepresentation.setMask(thirdPersonMask)
BirdEyeWindow.setCullMask(thirdPersonMask)

for z in range(-2, 2):
	viz.add('ball.wrl', pos=[0, 1, z])
__________________
Paul Elliott
WorldViz LLC
Reply With Quote