Just a snippet I made for a question someone had, I thought Id post it here, its a basic way of making sure the camera doesnt go behind polygons in a non-first person game.
SYNC ON:SYNC RATE 0:AUTOCAM OFF:HIDE MOUSE
MAKE MATRIX 1,1000,1000,10,10
MAKE OBJECT CUBE 1,10
MAKE OBJECT BOX 2,100,100,10
POSITION OBJECT 2,0,50,100
wallDist# = 5
DO
MOVE OBJECT 1, (UPKEY()-DOWNKEY())*0.5
YROTATE OBJECT 1, WRAPVALUE(OBJECT ANGLE Y(1) + ((RIGHTKEY()-LEFTKEY())*0.5))
x# = OBJECT POSITION X(1)
y# = OBJECT POSITION Y(1)
z# = OBJECT POSITION Z(1)
angle# = OBJECT ANGLE Y(1)
POSITION CAMERA x#,y#+20,z#
YROTATE CAMERA angle#
MOVE CAMERA -100
cx# = CAMERA POSITION X()
cy# = CAMERA POSITION Y()
cz# = CAMERA POSITION Z()
colDist# = INTERSECT OBJECT(2,cx#,cy#,cz#,x#,y#,z#)
IF colDist#
MOVE CAMERA colDist# + wallDist#
ENDIF
SYNC
LOOP
Not commented, pretty simple to understand.