I made a First Person script with a camera, but I want to know how to have a collision box around the camera so it will collide with objects. Please help. I'm using DarkBasic Pro for this. I really need the help. By the way, how do I make the camera jump or crouch.
Here is the code.
sync on
rem Make simple 3D scene
set camera range 1,115500
make matrix 1,6000,6000,25,25
position matrix 1,-3000,0,-3000
make object sphere 1,5000
set object 1,1,0,0
position camera 0,100,0
rem Begin loop
do
rem Crude way to fix mouse pointer (hide this and run again)
position mouse 320,240
rem Use MOUSEMOVE to alter camera angles
cx#=wrapvalue(cx#+mousemovey())
cy#=wrapvalue(cy#+mousemovex())
cz#=wrapvalue(cz#+mousemovez())
rotate camera cx#,cy#,cz#
rem placement of the camera on the ground
camposx#=camera position x()
camposz#=camera position z()
camposy#=get ground height(1,camposx#,camposz#)+50
rem Simple movement
if leftkey()=1 then camposx#=newxvalue(camposx#,cy#-90,4):camposz#=newzvalue(camposz#,cy#-90,4)
if rightkey()=1 then camposx#=newxvalue(camposx#,cy#+90,4):camposz#=newzvalue(camposz#,cy#+90,4)
if upkey()=1 then camposx#=newxvalue(camposx#,cy#,5):camposz#=newzvalue(camposz#,cy#,5)
if downkey()=1 then camposx#=newxvalue(camposx#,cy#,-3):camposz#=newzvalue(camposz#,cy#,-3)
position camera camposx#,camposy#,camposz#
rem Update screen
sync
rem End loop
loop