Heres a little snippet to demonstrate how to make the camera orbit around an object using the mouse..
Controls
* Use the right mose button and drag to orbit the camera
* Mouse wheel click and drag to zoom in and out, also up and down keys for those with a crappy mouse (no offense)
* 1 and 2 change the object to orbit
`Basic Startup
SYNC ON
SYNC RATE 60
AUTOCAM OFF
`Objects Vars
Object = 1
Object2 = 2
Radius = 50
Radius2 = 100
`Starting Object To Orbit
Orbiting = 1
`Make The Objects To Be Orbited
MAKE OBJECT SPHERE Object,Radius
POSITION OBJECT Object,0,0,0
MAKE OBJECT CUBE Object2,Radius2
POSITION OBJECT Object2,200,0,0
`Position The Camera Somewhere
POSITION CAMERA 0,0,-50
`Initialize the Focuse To Start Distance, Minimum Distance, and Maximum Distance
SetFocusToOrbit(-100,-Radius,-Radius * 5)
`Mainn Loop
DO
`Switch Between Objects
IF KEYSTATE(2)
Orbiting = 1
SetFocusToOrbit(-100,-Radius,-Radius * 5)
ENDIF
IF KEYSTATE(3)
Orbiting = 2
SetFocusToOrbit(-300,-Radius2,-Radius2 * 5)
ENDIF
`Update The Camera Position around the object
UpdateFocusToOrbit(Orbiting)
SYNC
LOOP
/// FUNCTIONS ///
FUNCTION SetFocusToOrbit( StartDis AS FLOAT , MinDis AS FLOAT , MaxDis AS FLOAT )
GLOBAL FocusDistance AS FLOAT
GLOBAL FocusMinDistance AS FLOAT
GLOBAL FocusMaxDistance AS FLOAT
FocusDistance = StartDis
FocusMinDistance = MinDis
FocusMaxDistance = MaxDis
ENDFUNCTION
FUNCTION UpdateFocusToOrbit( Object AS INTEGER )
POSITION CAMERA OBJECT POSITION X(Object),OBJECT POSITION Y(Object),OBJECT POSITION Z(Object)
IF MOUSECLICK()=2
XROTATE CAMERA CAMERA ANGLE X()+MOUSEMOVEY()*0.1
YROTATE CAMERA CAMERA ANGLE Y()+MOUSEMOVEX()*0.1
IF CAMERA ANGLE X()>80 THEN XROTATE CAMERA 80
IF CAMERA ANGLE X()<-60 THEN XROTATE CAMERA -60
ENDIF
IF MOUSECLICK() = 4 THEN FocusDistance=FocusDistance-MOUSEMOVEY()*0.25
if upkey()=1 then FocusDistance=FocusDistance+2.5
if downkey()=1 then FocusDistance=FocusDistance-2.5
if FocusDistance>FocusMinDistance then FocusDistance=FocusMinDistance
if FocusDistance<FocusMaxDistance then FocusDistance=FocusMaxDistance
move camera FocusDistance
if camera position y()<-60 then position camera camera position x(),-60,camera position z()
mousemovex()=0
mousemovey()=0
ENDFUNCTION
If you have any suggestions please let me know, especially if you can help out with transitions when changing objects
Also thanks to Evolved for his help, even though it wasnt direct..