Here is an ORBIT function:
function RotateCamera()
RotateTarget=0
MX# as float
MX#=MOUSEMOVEX()
MY# as float
MY#=MOUSEMOVEY()
if (MOUSECLICK() && 2)
if mousey()>DESKTOP HEIGHT()*0.75+10 then POSITION MOUSE mousex(),DESKTOP HEIGHT()*0.75+10
AngleY#=wrapvalue(AngleY#+(MX#/5.0))
AngleX#=wrapvalue(AngleX#+(MY#/5.0))
Drag=1
else Drag=0
endif
if AngleX#>70.0 then AngleX#=70.0
if AngleX#<10.0 then AngleX#=10.0
CameraDistance#=CameraDistance#+MouseScroll
if CameraDistance#>1000.0 then CameraDistance#=1000.0
if CameraDistance#<10.0 then CameraDistance#=10.0
position camera CameraX#,CameraY#+5.0,CameraZ# `the lookat point
rotate camera AngleX#,AngleY#,0.0
move camera -CameraDistance#
endfunction
You need to assign globals:
AngleX#, AngleY#, CamerX#, CameraY#, CameraZ#, and CameraDistance#
CamerX#, CameraY#, and CameraZ# are the FOCAL POINT of the orbit.
You can do a XYZ MOVE function a few ways. I don't have an example code that I can give you right now, but it's not that complicated. You can simply position the camera at the CamerX#, CameraY#, and CameraZ# and move the camera forward using the mousey() return, move it left/right using the mousex() return. If you want to put constraints on an axis, it will be a little different, but I think you can figure that out on your own. If you can't, let me know, and I'll give you a couple examples.
The fastest code is the code never written.