I am trying to simulate the speed of light in a 3D solar system project I'm creating (nothing as grand as some of the other efforts I have seen on these forums, credit to those who have created them!) It seems like a popular choice of project so I thought I'd have a go. Some problems:
1. How can I calculate the speed of light with regards to the sync rate and movement of the camera?
2. May be a rookie mistake by me, but why is Neptune trying to get a front row seat? (seems to be sitting at 205M km from the sun, between Earth and Mars when it's supposed to be much further away!
It is very basic coding as I haven't coded for a long while.
sync on
sync rate 100
hide mouse
load image "sun.jpg",10
load image "mercury.jpg",1
load image "venus.jpg",2
load image "earth.jpg",3
load image "mars.jpg",4
load image "jupiter.jpg",5
load image "saturn.jpg",6
load image "uranus.jpg",7
load image "neptune.jpg",8
load image "pluto.jpg",9
load image "sky.jpg",11
`sun
make object sphere 10,1400000
position object 10,0,0,0
`mercury
make object sphere 1,4900
position object 1,0,0,58000000
`venus
make object sphere 2,12100
position object 2,0,0,108000000
`earth
make object sphere 3,12800
position object 3,0,0,150000000
`mars
make object sphere 4,6800
position object 4,0,0,228000000
`jupiter
make object sphere 5,143000
position object 5,0,0,778000000
`saturn
make object sphere 6,120000
position object 6,0,0,1430000000
`uranus
make object sphere 7,51800
position object 7,0,0,2870000000
`neptune
make object sphere 8,49500
position object 8,0,0,4500000000
`pluto
make object sphere 9,2300
position object 9,0,0,5900000000
for x=1 to 10
texture object x,x
next x
texture backdrop 11
sync
position camera 0,0,0
set camera range 1,500000000
speed=10000
do
if upkey()=1 then move camera speed
if downkey()=1 then move camera speed-(2*speed)
if leftkey()=1 then turn camera left 1
if rightkey()=1 then turn camera right 1
text 0,0,"Distance from Sun: "+str$(camera position z()/1000000)+" million km"
text 0,100,"(C)entre camera"
text 0,120,"(M)ercury"
text 0,140,"(V)enus"
text 0,160,"(E)arth"
text 0,180,"M(A)rs"
text 0,200,"(J)upiter"
text 0,220,"(S)aturn"
text 0,240,"(U)ranus"
text 0,260,"(N)eptune"
text 0,280,"(P)luto"
text 0,320,"Speed:"
text 0,340,"(1) Slowest (1)"
text 0,360,"(2) Slow (1000)"
text 0,380,"(3) Medium (10000)"
text 0,400,"(4) Fast (100000)"
text 0,420,"(5) Fastest (1000000)"
if speed=100 then speed$="SLOWEST"
if speed=1000 then speed$="SLOW"
if speed=10000 then speed$="MEDIUM"
if speed=100000 then speed$="FAST"
if speed=1000000 then speed$="FASTEST"
text 0,440,"Current speed setting: "+speed$
gosub positioning
sync
loop
positioning:
if inkey$()="c" then position camera 0,0,camera position z()
if inkey$()="m" then position camera 0,0,56000000:point camera 0,0,58000000
if inkey$()="v" then position camera 0,0,106000000:point camera 0,0,108000000
if inkey$()="e" then position camera 0,0,148000000:point camera 0,0,150000000
if inkey$()="a" then position camera 0,0,226000000:point camera 0,0,228000000
if inkey$()="j" then position camera 0,0,776000000:point camera 0,0,778000000
if inkey$()="s" then position camera 0,0,1428000000:point camera 0,0,1430000000
if inkey$()="u" then position camera 0,0,2868000000:point camera 0,0,2870000000
if inkey$()="n" then position camera 0,0,4498000000:point camera 0,0,4500000000
if inkey$()="p" then position camera 0,0,5898000000:point camera 0,0,5900000000
if inkey$()="1" then speed=100
if inkey$()="2" then speed=1000
if inkey$()="3" then speed=10000
if inkey$()="4" then speed=100000
if inkey$()="5" then speed=1000000
return
The Solar System I've created is roughly full size, with 1 unit of 3D space in DB being 1km.
Fight the good fight of faith,
Lay hold on Eternal Life.
-1 Timothy 6:12-