Used two different definitions of distance so objects can have realistic orbital speed but not huge orbits.

This commit is contained in:
Quantum 2013-10-26 16:35:47 -04:00
parent 5312c4f1dd
commit 43636c1eb7
2 changed files with 11 additions and 7 deletions

View file

@ -2,8 +2,8 @@
"au": "greatly shrunk so planets can actually be seen", "au": "greatly shrunk so planets can actually be seen",
"au": 10000, "au": 10000,
"tick": 4320, "tick": 4320,
"length": "kilometre per world units for satellite distance, note that this is approx 10x smaller than AU", "length": "kilometre per world units for satellite distance",
"length": 637, "length": 63.7,
"planets": { "planets": {
"earth": { "earth": {
"texture": ["earth.jpg", "earth_medium.jpg", "earth_small.jpg", [0, 0.28, 1, 1]], "texture": ["earth.jpg", "earth_medium.jpg", "earth_small.jpg", [0, 0.28, 1, 1]],
@ -22,7 +22,8 @@
"moon": { "moon": {
"texture": ["moon.jpg", "moon_medium.jpg", "moon_small.jpg", [0.53, 0.53, 0.53, 1]], "texture": ["moon.jpg", "moon_medium.jpg", "moon_small.jpg", [0.53, 0.53, 0.53, 1]],
"radius": 27.25, "radius": 27.25,
"distance": 384399, "distance": 38439,
"sma": 384399,
"eccentricity": 0.0549, "eccentricity": 0.0549,
"inclination": 5.145, "inclination": 5.145,
"pitch": -90, "pitch": -90,
@ -31,7 +32,7 @@
"iss": { "iss": {
"model": "satellites/iss.obj", "model": "satellites/iss.obj",
"inclination": 51.65, "inclination": 51.65,
"distance": 68000, "distance": 6800,
"scale": 5 "scale": 5
} }
} }
@ -45,7 +46,9 @@
"mass": 6.4185e+23, "mass": 6.4185e+23,
"satellites": { "satellites": {
"phobos": { "phobos": {
"distance": 93770, "distance": 9377,
"inclination": 26.04,
"eccentricity": 0.0151,
"model": "satellites/phobos.obj" "model": "satellites/phobos.obj"
} }
} }

View file

@ -106,9 +106,10 @@ def load_world(file):
type = Planet type = Planet
else: else:
x, y, z = parent.location x, y, z = parent.location
distance = e(info.get('distance', 100)) # Distance here means semi-major axis distance = info.get('distance', 100) # Semi-major axis when actually displayed in virtual space
sma = info.get('sma', distance) # Semi-major axis used to calculate orbital speed
if hasattr(parent, 'mass') and parent.mass is not None: if hasattr(parent, 'mass') and parent.mass is not None:
speed = 360 / (2 * pi * sqrt((distance * 1000) ** 3 / (G * parent.mass)) / tick) speed = 360 / (2 * pi * sqrt((sma * 1000) ** 3 / (G * parent.mass)) / tick)
else: else:
speed = info.get('orbit_speed', 1) speed = info.get('orbit_speed', 1)
type = Satellite type = Satellite