Hey, I just made a 'wall' out of a box by using 'make object box' in dark basic pro, and then I made a collision box for the wall. The sliding collision with the box and wall seems to work perfectly. Does anybody know why it works fine with the wall but not with the map that I made? Is it because the map is in .dbo format or because I set the map's collision mode to polygons and didn't use a collision box with the map or something like that? Please also refer to my new code below if you need to.
Rem Project: My FPS Game
Rem Created: Saturday, November 14, 2009
Rem ***** Main Source File *****
rem basic settings
sync on: sync rate 0
hide mouse
set window off
autocam off
set dir "Files"
rem map commands
make object box 1, 1000, 300, 100
position object 1, 0, 0, 100
make object collision box 1, -500, -150, -50, 500, 150, 50, 0
rem make and setup 'character' box
make object cube 2, 50
rem collision for cube
make object collision box 2, -25, -25, -25, 25, 25, 25, 0
xpos# = 0
ypos# = 30
zpos# = 0
position object 2, 0, 30, 0
rem camera variables
fCameraAngleX = 0.0
fCameraAngleY = 0.0
rem main loop
do
rem move camera
fCameraAngleX = wrapvalue (fCameraAngleX + MouseMoveY()*0.2)
fCameraAngleY = wrapvalue (fCameraAngleY + MouseMoveX()*0.2)
XRotate camera fCameraAngleX
YRotate camera fCameraAngleY
rem camera controls
if keystate(17) = 1 then move camera 0.2
if keystate(31) = 1 then move camera -0.2
rem move the cube
if upkey()= 1 then move object 2, 0.2
if downkey()= 1 then move object 2 ,-0.2
if leftkey()= 1 then move object left 2, 0.2
if rightkey()= 1 then move object right 2, 0.2
rem update the position variables after moving
xpos# = object position X (2)
ypos# = object position y (2)
zpos# = object position z (2)
rem sliding collision
if object collision (2, 0) > 0
dec xpos#, get object collision x()
dec ypos#, get object collision y()
dec zpos#, get object collision z()
endif
position object 2, xpos#, ypos#, zpos#
rem update the screen
sync
rem repeat again
loop
Thanks
Chappy