For some strange reason this works:
sync on : hide mouse
sync rate 30
make matrix 1, 200.0, 200.0, 20, 20
position matrix 1, 0, 0, 0
make object box 3, 200, 30, 5 : color object 3, rgb(0, 0, 0)
position object 3, 100, 15, 0
make object box 4, 200, 30, 5 : color object 4, rgb(0, 0, 0)
position object 4, 100, 15, 200
make object box 5, 200, 30, 5 : color object 5, rgb(90, 100, 67)
position object 5, 200, 15, 100 : yrotate object 5, 90
make object box 6, 90, 30, 5 : color object 6, rgb(90, 110, 56)
position object 6, 0, 15, 45 : yrotate object 6, 90
camobj=7
make object sphere camobj, 2
hide object camobj
position camera 10, 10, 10
point camera 150, 10, 5
set camera range 1,2000
DO
oldx#=camera position x()
oldz#=camera position z()
set cursor 5,5
print screen fps()
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)
if upkey()=1 then move camera 10
if downkey()=1 then move camera -10
x#=camera position x()
z#=camera position z()
y#=get ground height(1,x#,z#)+10
position camera x#,y#,z#
position object camobj, x#, y#, z#
if object collision(camobj,3)
position camera oldx#,y#,oldz#
endif
position object camobj, Camera Position x(), y#, Camera position z()
if object collision(camobj,4)
position camera oldx#,y#,oldz#
endif
position object camobj, Camera Position x(), y#, Camera position z()
if object collision(camobj,5)
position camera oldx#,y#,oldz#
endif
position object camobj, Camera Position x(), y#, Camera position z()
SYNC
LOOP
But if you want it to work on every object just use this. I changed IF OBJECT COLLISION(camobj,3) into IF OBJECT COLLISION(camobj,0), and erased all the other collision stuff. The 0 makes it apply for ALL of the objects.
sync on : hide mouse
sync rate 30
make matrix 1, 200.0, 200.0, 20, 20
position matrix 1, 0, 0, 0
make object box 3, 200, 30, 5 : color object 3, rgb(0, 0, 0)
position object 3, 100, 15, 0
make object box 4, 200, 30, 5 : color object 4, rgb(0, 0, 0)
position object 4, 100, 15, 200
make object box 5, 200, 30, 5 : color object 5, rgb(90, 100, 67)
position object 5, 200, 15, 100 : yrotate object 5, 90
make object box 6, 90, 30, 5 : color object 6, rgb(90, 110, 56)
position object 6, 0, 15, 45 : yrotate object 6, 90
camobj=7
make object sphere camobj, 2
hide object camobj
position camera 10, 10, 10
point camera 150, 10, 5
set camera range 1,2000
DO
oldx#=camera position x()
oldz#=camera position z()
set cursor 5,5
print screen fps()
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
CameraAngleY# = WrapValue(CameraAngleY#+MousemoveX()*0.2)
CameraAngleX# = WrapValue(CameraAngleX#+MousemoveY()*0.2)
Yrotate camera CurveAngle(CameraAngleY#,OldCamAngleY#,24)
Xrotate camera CurveAngle(CameraAngleX#,OldCamAngleX#,24)
if upkey()=1 then move camera 10
if downkey()=1 then move camera -10
x#=camera position x()
z#=camera position z()
y#=get ground height(1,x#,z#)+10
position camera x#,y#,z#
position object camobj, x#, y#, z#
if object collision(camobj,0)
position camera oldx#,y#,oldz#
endif
SYNC
LOOP
