correct, the fov is a variable.
Don't know who the original author was, but here's code for DBC.
set display mode 800,600,16
sync on
sync rate 0
set camera range 10,1000000
make matrix 1,10000,10000,15,15
`position matrix 1,-5000,0,-5000
make object sphere 1,100
position camera 0,1000,0
cx#=0
cy#=1000
cz#=0
cspd#=6
cyspd#=4
rem the important thing about this code is it relies on knowing the point that the camera is looking at
rem on the plane you want to use, in this case I use 'point camera' so I know where it is looking.
rem offsetx#, offsety# and offsetz# store the co-ordinates the camera is looking at.
rem include this at the start of your code...
offsetx#=1000
offsety#=0
offsetz#=1000
point camera offsetx#,offsety#,offsetz#
screenwidth=screen width()/2.0
screenheight=screen height()/2.0
scalefactor#=screen height()/1.2
rem ...until here
do
set cursor 0,0 : print screen fps()
rem then include from here...
mouseposx#=mousex()-screenwidth
mouseposy#=screenheight-mousey()
dist#=sqrt((camera position x()-offsetx#)^2+(camera position y()-offsety#)^2+(camera position z()-offsetz#)^2)
if mouseposy#<>0
vectorang#=atanfull(scalefactor#,mouseposy#)
else
vectorang#=90.0
endif
if vectorang#+camera angle x()>90.965
ratio#=mouseposy#/(sin((vectorang#+camera angle x() )-90.0))
cursorposy#=ratio#*sin(180.0-vectorang#)
else
cursorposy#=1000000.0
endif
hyplength#=scalefactor#/sin(vectorang#)
cursorposx#=(((ratio#*sin(90.0-camera angle x() ))/hyplength#)+1.0)*mouseposx#
if mouseposx#<>0
angtotal#=wrapvalue(camera angle y()-atanfull(mouseposy#,mouseposx#))
else
if mouseposy#<0
angtotal#=wrapvalue(camera angle y()+90.0)
else
angtotal#=wrapvalue(camera angle y()-90.0)
endif
endif
cameraang#=wrapvalue(360.0-camera angle y() )
cosang#=cos(cameraang#)
sinang#=sin(cameraang#)
movex#=(dist#/scalefactor#)*((cosang#*cursorposx#)+((-1*sinang#)*cursorposy#))
movez#=(dist#/scalefactor#)*((sinang#*cursorposx#)+(cosang#*cursorposy#))
movex#=movex#+offsetx#
movez#=movez#+offsetz#
movey#=offsety#
position object 1,movex#,offsety#,movez#
rem ...to here in the main loop (change the value of position object to the object you want to put at mouse co-ords.
if mouseclick()=1 and hold=0
hold=1
point camera movex#,movey#,movez#
offsetx#=movex#
offsety#=movey#
offsetz#=movez#
endif
if mouseclick()=0 then hold=0
gosub _Control_Camera
sync
loop
_Control_Camera:
if upkey() then inc cz#,cspd#
if downkey() then dec cz#,cspd#
if rightkey() then inc cx#,cspd#
if leftkey() then dec cx#,cspd#
if scancode()=30 then inc cy#,cyspd#
if scancode()=44 then dec cy#,cyspd#
if cy#>400 then cy#=400
if cy#<100 then cy#=100
position camera cx#,cy#+500,cz#
offsetx#=cx#
offsety#=0
offsetz#=cz#+300
point camera cx#,0,cz#+300
RETURN
"eureka" - Archimedes