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

View file

@ -106,9 +106,10 @@ def load_world(file):
type = Planet
else:
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:
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:
speed = info.get('orbit_speed', 1)
type = Satellite