Hello friends just started using darkbasicpro a couple of days ago
and just having some trouble with the camera follow command.
I have it working just not as good as I would like.
when I turn for a certain amount of time the camera stops rotating
while the cube keeps rotating,at first i thought this was to do with
the camera hitting the bsp but when i take out the bsp camera collision command it still happens so im not sure why this happens.
any help on how to improve this code would be helpful thanks
this is my code:
rem Set camera
set camera range 0.1,5000
position camera 0,50,0
rotate camera 0,45,0
rem set variables
Camdist# = 80
TrackAngle = 0
CamHeight# = 100
Camsmooth = 15
ColFlag = 0
Make Matrix 1,500,500,20,20
REM MAKE PLAYER
MAKE OBJECT CUBE 1,30
POSITION OBJECT 1,0,50,10
REM BSP SET UP
LOAD BSP "MAP/level.dat","my first bsp.bsp"
set bsp camera collision 1,0,0.75,0
set bsp collision threshhold 1,0.001
set bsp object collision 2,1,8,0
rem Main loop
do
rem control cube
if upkey() then move object 1,2
if downkey() then move object 1,-2
if leftkey() then TURN OBJECT LEFT 1,1
if rightkey()then TURN OBJECT right 1,1
if keystate(30) then move object left 1,2
if keystate(31) then move object right 1,2
REM CAMERA FOLLOW
ObjX# = Object Position X(1)
ObjZ# = Object Position Z(1)
ObjHeight# = Get Ground Height(1,ObjX#,ObjZ#)
Set Camera To Follow ObjX#,ObjHeight#,ObjZ#,WrapValue(Object Angle Y(1)+TrackAngle),Camdist#,Camheight#,Camsmooth,ColFlag
rem Update screen
sync
rem End loop
loop
spartical did do it