Because the camera in camera follow is too "loose". I tried it, and when you move forward from a stop the camera falls way back and slowly catches up. When you move back the ball goes behind the camera for a second the catches up. I almost fixed the camera though. The only problem now is that when you land on the box, the camera falls to ground level, and the sphere stays on the box like it's supposed to.
Here's the new code:
sync on
sync rate 0
yvel=0
load image "ground.bmp",1
make object sphere 1,50
make object collision box 1,-25,-25,-25,25,25,25,0
make matrix 1,10000,10000,100,100
randomize matrix 1,50
prepare matrix texture 1,1,1,1
set matrix texture 1,1,1
position matrix 1,-5000,0,-5000
make object box 2,100,100,100
position object 2,100,50,100
make object collision box 2,-50,-50,-50,50,50,50,0
make object box 3,75,75,75
position object 3,100,75,210
make object collision box 3,-50,-50,-50,50,50,50,0
make object box 4,75,75,75
position object 4,100,100,320
make object collision box 4,-50,-50,-50,50,50,50,0
do
Rem Get object angle
oby#= object angle y(1)
Rem allow object to respond to keypresses
if upkey()=1 then move object 1,2.5
if downkey()=1 then move object 1,-5.5
if leftkey()=1 then yrotate object 1,wrapvalue(oby#-2.5)
if rightkey()=1 then yrotate object 1,wrapvalue(oby#+2.5)
if spacekey()=1 and yvel=0 then yvel = 150
if yvel > 0 then yvel = yvel - 1
obpx#= object position x(1)
obpz#= object position z(1)
obpy#= object position y(1)
Rem position object at these co-ordinates
if object collision(1,0)
dec obpx#,get object collision x()
inc obpy#,get object collision y()
dec obpz#,get object collision z()
print "collide"
endif
position object 1,obpx#,get ground height (1,obpx#,obpz#)+30+yvel,obpz#
Rem Using the newxvalue and newzvalue functions, work out a
Rem camera position based upon objects location i.e. 100 Rem world units away and slightly above.
camx#= newxvalue(obpx#,oby#-180,100)
camz#= newzvalue(obpz#,oby#-180,100)
position camera camx#,obpy#+20,camz#
rem point camera at object
point camera obpx#,obpy#,obpz#
rem refresh screen and loop
sync
loop