This code moves a camera up a slanted plane.
Don't panic: Ignore the memblock stuff, that is just to make the grid image.
The intersect object command is the important part to this code.
sync on
autocam off
sync rate 0
hide mouse
make memblock 1,100*100*4+12
write memblock dword 1,0,100
write memblock dword 1,4,100
write memblock dword 1,8,32
for x=1 to 100 step 5
for y=1 to 100
write memblock dword 1,((y-1)*100+x-1)*4+12,rgb(0,255,255)
next y
next x
for x=1 to 100
for y=1 to 100 step 5
write memblock dword 1,((y-1)*100+x-1)*4+12,rgb(0,255,255)
next y
next x
make image from memblock 1,1
make object plain 1,1000,1000
texture object 1,1
rotate object 1,rnd(20)+80,rnd(359),rnd(20)-10
position camera 0,20,0
do
sync
x#=camera angle x()
xrotate camera 0
move camera upkey()-downkey()
rotate camera x#+mousemovey()/2.0,camera angle y()+mousemovex()/2.0,0
int#=intersect object (1,camera position x(),camera position y(),camera position z(),camera position x(),camera position y()-20,camera position z())
if int#>0
position camera camera position x(),camera position y()-int#+5,camera position z()
else
position camera camera position x(),camera position y()-1,camera position z()
endif
loop
Insanity is just a state of mind