I tried using the demo "First Person Game" and using my map on it. The floor collisions work flawlessly, but the walls do not. Playing around with this bit:
rem If collision, calculate new ADJUSTED NEW camera position to avoid this collision
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
when the cmx# line is commented out, I'm free to move along the x axis with the occasional ability to move along z a bit. Commenting out the cmz# does the same with the opposite axis. Commenting both out leaves a tiny area to move around in. Not sure what is going on here, or where its getting the collisions.
Here's the full program:
rem Use desktop resolution, vsync on
sync on : sync rate 0
desktopwidth=900
desktopheight=650
set display mode desktopwidth,desktopheight,32,1
rem Initialize application and hide mouse pointer
autocam off : hide mouse : disable escapekey
rem Set font
set text font "Ariel"
ink rgb(255,255,200),0
set text size 20
rem Load level (load static objects read a DBO and DBU file pair)
gdividetexturesize=0 : universefile$="levelbank\testlevel\universe.dbo"
set dir "C:\Program Files (x86)\The Game Creators\FPS Creator Free\Files" : load static objects universefile$,gdividetexturesize
rem Place camera (the topmost/leftmost/lowest tile of the FPSC level universe)
rem Remember that these coordinates will change with each new FPSC level used
position camera 850,555,-2029
point camera 845,555,-2050
set ambient light 50
rem Main loop
while escapekey()=0
`
rem Control camera
BACKDROP ON
COLOR BACKDROP rgb(0,255,0)
gosub _camera
`
rem Show on-screen displays
center text screen width()/2,screen height()-50,"FPS CREATOR LEVEL LOADED INTO DARK BASIC PROFESSIONAL"
`
rem Keep light with camera
set point light 0,camera position x(),camera position y()+50,camera position z()
`
rem Update
sync
`
endwhile
rem Delete level
delete static objects
rem End program
end
_camera:
rem Read W,A,S,D keys for movement
tkeystate17=keystate(17)
tkeystate31=keystate(31)
tkeystate30=keystate(30)
tkeystate32=keystate(32)
rem Store CURRENT camera position
cox#=camera position x()
coy#=camera position y()
coz#=camera position z()
rem Determine camera direction
movement=0
if tkeystate17=1
if tkeystate30=1
y#=315 : movement=1
else
if tkeystate32=1
y#=45 : movement=1
else
y#=0 : movement=1
endif
endif
else
if tkeystate31=1
if tkeystate30=1
y#=225 : movement=1
else
if tkeystate32=1
y#=135 : movement=1
else
y#=180 : movement=1
endif
endif
else
if tkeystate30=1
y#=270 : movement=1
else
if tkeystate32=1
y#=90 : movement=1
endif
endif
endif
endif
rem Store camera angles
sx#=camera angle x()
sy#=camera angle y()
sz#=camera angle z()
REM Hud
set cursor 20, 25 : print "Camera height:"; str$(CAMERA POSITION Y())
set cursor 20, 45 : print "Camera Pos. X:"; str$(CAMERA POSITION X())
set cursor 20, 65 : print "Camera Pos. Z:"; str$(CAMERA Position Z())
set cursor 20, 85 : print "Camera angle (degrees):"; str$(CAMERA ANGLE Y())
rem Move camera in direction and restore camera angles
rotate camera 0,camera angle y()+y#,0
if movement=1 then move camera 3.0
rotate camera sx#,sy#,sz#
rem Store NEW camera position (and apply gravity)
cmx#=camera position x()
cmy#=camera position y()-gravity#
cmz#=camera position z()
rem Check volume collision between CURRENT and NEW camera positions
if static volume(cox#,coy#-25,coz#,cmx#,cmy#-25,cmz#,1.0)=1
`
rem If collision detected, determine material touching
materialtype=get static collision value()
`
rem If collision, calculate new ADJUSTED NEW camera position to avoid this collision
`cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
`cmz#=coz#+get static collision z()
`
rem Reset gravity
gravity#=0.5
`
else
`
rem If no collision, must be in freefall so increase gravity
inc gravity#,0.5
`
endif
rem Update camera with ADJUSTED NEW position
position camera cmx#,cmy#,cmz#
rem Mouselook control
position mouse 400,300
cammovex#=mousemovex()*2
cammovey#=mousemovey()*2
camangx#=camera angle x()+cammovey#
camangy#=camera angle y()+cammovex#
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera curveangle(camangx#,camera angle x(),15.0),curveangle(camangy#,camera angle y(),15.0),camera angle z()
REM reset camera if it falls off the map
if (CAMERA POSITION Y() < 0) then position camera 850,555,-2029 : point camera 850,555,-2050
Rem No Code beyond this point!
return