PDA

View Full Version : Importing Scaffold scene


betancourtb82
04-10-2006, 12:21 PM
I have a slight problem. Farshizzo has so kindly helped me with using the crosshair as a 3d object. The problem is that I am also trying import the scaffold scene. The problem I'm having is that when I insert the scaffold scene the crosshair disappears. I'm thinking it has to do w/the textures, but I'm not sure. Is it possible to use the crosshair with the scaffold?

Here is the code I used to insert the scaffold scene:
sunlight = viz.add(viz.LIGHT)
sunlight.position(10,10,-20)
sunlight.direction(-0.5,-0.5,1)
sunlight.color(1,1,1)

sky = viz.add('skydome.dlc',0,'',15)
env = viz.add(viz.ENVIRONMENT_MAP,'sky.bmp')
sky.texture(env)
sky.disable(viz.FOG)

#Add 3D objects
panorama = viz.add('full_cyl1.wrl')
#ground = viz.add('bottom.wrl')
#scaffold = viz.add('scaffold2.wrl')


court = viz.add('scaffold2.wrl')
court.scale(0.5,0.5,0.5)
court.rotate(0,1,0,-90)
court.translate(-5,0,-10)
court.appearance(viz.MODULATE)
court.disable(viz.LIGHT0)

Here is the code for the crosshair insertion:
crosshair = viz.add(viz.TEXQUAD)
crosshair.texture(viz.add('crosshair.tif'))
crosshair.scale(0.01,0.01,0.01)

Here is the code to control the movement of the crosshair (within a timer):
linepos = viz.mousepos()
#line = viz.screentoworld(viz.mousepos())
line = viz.screentoworld(linepos[0]+.11,linepos[1])
v = viz.Vector(viz.get(viz.HEAD_POS))
dir = viz.Vector(line[3:]) - viz.Vector(line[:3])
dir.normalize()
dir *= 0.1 #Place crosshair 1/10th meter in front of user
v += dir
crosshair.translate(v.get())
crosshair.rotatequat(viz.get(viz.VIEW_QUAT))

farshizzo
04-10-2006, 12:34 PM
Hi,

The following code should fix it.viz.clip(0.01,1000)

betancourtb82
04-10-2006, 12:44 PM
THANK YOU! That worked perfectly

betancourtb82
04-10-2006, 02:01 PM
One thing that was weird is that the crosshair shows up separately on each eye when I put on the HMD. Is there a way to fix this?

farshizzo
04-10-2006, 02:27 PM
Hi,

I'm not sure what you mean. When you view a scene in stereo ALL objects should be showing up separately in each eye. If an object only appears on one eye then you lose the stereo effect.

betancourtb82
04-10-2006, 02:39 PM
What I mean is that 2 crosshairs appear, both showing up on the screen at the same time. The problem is that when I click, bullets come out of the left eye, but nothing comes out of the right eye. Is there a way to make both crosshairs match up so that when I point, regardless of which of the 2 crosshairs I'm looking at, I'll get an accurate shot?