Using AppGameKit Studio, I have been working on an accurate 3D model of the solar system that shows planetary positions based on any given date. Year, Month and Day can be changed in realtime as you watch the planets orbit the sun. There are a lot of programs out there on the internet that do the same thing. But this code was mainly a "learning" experience for me. It includes free flight code so you can fly around the solar system using WASD. Also includes a spherical skymap with stars and constellations, orbital paths, high-resolution textures, music, sound effects, virtual buttons, compass, various visual grids, acceleration inputs, etc.
I learned more by browsing through peoples code than by reading the documentation. And I greatly appreciated people sharing their code so we could all learn from it. Just thought it was time for me to also share.
-----------------------------------------------------------------------------
For example, here is an extract of the equations for Mercury based on orbital elements and the Keplerian equations.
`MERCURY
Mercury.name= "Mercury"
Mercury.sname= "Mer"
Mercury.incli= 007.004986
Mercury.l_of_anode= 048.330893
Mercury.l_of_peri= 077.456119
Mercury.dist= 000.3870978
Mercury.daily_motion= 004.092353
Mercury.ecc= 000.2056324
Mercury.mean_long= 252.250906
Mercury.mean_anom= Mercury.daily_motion * d# + Mercury.mean_long - Mercury.l_of_peri
Mercury.mass= 003.30200E23
Mercury.radius= 002.44E6
Mercury.spin= CommonMultiplier*-.017050 `24/(58.65*24)
Mercury.tilt= 007.0
`MERCURY Movement Calculation Using Keplerian Equations..............................................................................................
MMer# = WrapAngle(Mercury.daily_motion * d# + Mercury.mean_long - Mercury.l_of_peri)
vMer# = MMer#+Rads#*(((2*Mercury.ecc-Mercury.ecc^.75)*sin(MMer#)) + (1.25*Mercury.ecc^2*sin(2*MMer#)) + (1.0833*Mercury.ecc^3*sin(3*MMer#)))
rMer# = Mercury.dist*(1-Mercury.ecc^2)/(1+Mercury.ecc*cos(vMer#))
Mervop#=WrapAngle(vMer#+Mercury.l_of_peri-Mercury.l_of_anode)
XMer#=rMer#*(cos(Mercury.l_of_anode)*cos(Mervop#)-sin(Mercury.l_of_anode)*sin(Mervop#)*cos(Mercury.incli))
YMer#=rMer#*(sin(Mercury.L_of_anode)*cos(Mervop#)+cos(Mercury.l_of_anode)*sin(Mervop#)*cos(Mercury.incli))
ZMer#=rMer#*(sin(Mervop#)*sin(Mercury.incli))
SetObjectPosition(Mer,XMer#*DisS#,ZMer#*DisS#,YMer#*DisS#)
-----------------------------------------------------------------------------
Happy to share the code, if anyone is interested. This is my first post, so I am not sure I posted the images correctly.
Jf