I appologise for the state of my coding.
set display mode 1280,1024,32
hide mouse
make matrix 1,1000,1000,25,25
load object "C:\My Documents\3dsmax\export\simple room3.x",1
position object 1,500,1,500
scale object 1,400,400,400
xrotate object 1,270
make object sphere 200,10
position object 200,x#,21,z#
color object 200,0
x#=500
gy#=200
z#=500
sync on
do
oldx# = x#
oldz# = z#
`Player controls
`Mouse "Look" Routine
cx#=wrapvalue(cx#+mousemovey())
cy#=wrapvalue(cy#+mousemovex())
cz#=wrapvalue(cz#+mousemovez())
rotate camera cx#,cy#,cz#
`Move Camera
if keystate(17)=1 then x#=newxvalue(x#,cy#,1) : z#=newzvalue(z#,cy#,1)
if keystate(31)=1 then x#=newxvalue(x#,cy#,-1) : z#=newzvalue(z#,cy#,-1)
if keystate(30)=1 then z#=newzvalue(z#,cy#-90,1) : x#=newxvalue(x#,cy#-90,1)
if keystate(32)=1 then z#=newzvalue(z#,cy#-90,-1) : x#=newxvalue(x#,cy#-90,-1)
`crouch routine
IF keystate(46)=1
if flag = 0
ButtonOn = 1 - ButtonOn
flag = 1
gy#=120
endif
else
flag = 0
gy#=200
ENDIF
`Update Camera Position
y#=get ground height(1,x#,z#)+gy#
position camera x#,y#,z#
position object 200,x#,21,z#
`Collision data
set object collision to polygons 1
obj= 1
if object collision(200,obj)>0 then x#=oldx# : z#=oldz#
`Debug info
set cursor 0,0
print "cy#=";cy#
print "cx#=";cx#
print "cz#=";cz#
print "Xpos";x#
print "Zpos";z#
Print "FPS";screen fps()
sync
Loop
I can see from your smile, you're not here for the sunset.