Alright... I did a bit of tweaking and I kinda sorta fixed the camera... but I can't seem to keep the camera at a fixed distance... or when I tell the ship to pull upward it just pulls the object not the camera as well... here is my code that I have "tweaked"
`load all junk and hide mouse
ship = 1
hide mouse
load object "starfighter.3ds",ship
load image "blueworld.jpg",2
load image "moon.jpg",3
`position starfighter and scale down
position object ship, 20,20,20
rotate object ship, 0,90,0
fix object pivot ship
rem stars
for f=1 to 50 : e=rnd(255) : dot rnd(255),rnd(255),rgb(e,e,e) : next f : get image 1,0,0,256,256
rem star sphere
make object sphere 99,30000000000000,20,20 : texture object 99,1
scale object texture 99,8,8 : set object 99,1,0,0,0,0,0,0
rem set camera to see stars
set camera range 1,30000000000000
rem create planet
make object sphere 100,2300000,20,20 : texture object 100,2
position object 100, 2300000,2300000,23000
`create a moon for our planet
make object sphere 101,400000,20,20 :texture object 101,3
position object 101,2300000+43000,230000+ 33000,4000
rem declare all variables
distance# = 20
speed = 0
sync on
do
gosub player_control
gosub camera_commands
gosub throttle
move camera speed
move object ship, speed
point camera posx#,posy#,posz#
sync
loop
rem takes care of all speed issues
throttle:
if upkey() = 1 then speed = speed + 1
if downkey() = 1 then speed = speed - 1
if speed < 1 then speed = 1
if speed > 6000 then speed = 6000
return
` tracks ship
camera_commands:
posx#=object position x (ship)
posy#=object position y (ship)
posz#=object position z (ship)
posay#=object angle y (ship)
posax#=object angle x (ship)
posaz#=object angle z (ship)
distance#=10
hight#= 10
set camera to follow posx#,posy#,posz#,posay#,distance#,hight#,smooth,collision
position camera posx#,posy#,posz#
rotate camera posax,posay,posaz
return
`all of the free flight controls
player_control:
if keystate(17) = 1 then pitch object down ship,.5
if keystate(31) = 1 then pitch object up ship,.5
if keystate(30) = 1 and st = 0 then roll object left ship,.5 else if keystate(30) = 1 and st = 1 then tr = tr - 1
if keystate(32) = 1 and st = 0 then roll object right ship,.5 else if keystate(32) = 1 and st = 1 then tr = tr + 1
if keystate(30) = 1 and st = 0 then roll camera left .5 else if keystate(30) = 1 and st = 1 then tr = tr -1
if keystate(32) = 1 and st = 0 then roll camera right .5 else if keystate(32) = 1 and st = 1 then tr = tr + 1
if tr < -15 then tr = -15
if tr > 15 then tr = 15
if tr < 0 then tr = tr + 0.1
if tr > 0 then tr = tr - 0.1
roll object right ship,tr
return
the ship is in the download button on any of the above download buttons...
Cheers,
Christian