@@ 1,10 1,16 @@
-pub const GAME_SCALE: f64 = 0.0001567865; // 1000 / EARTH_RADIUS_RL
+pub const GAME_SCALE_DISTANCE: f64 = 0.0001567865; // 1000 / EARTH_RADIUS_RL
+pub const GAME_SCALE_MASS: f64 = 0.0000000000000000000006697923643670463; // 4000 / EARTH_MASS_RL
pub const EARTH_RADIUS_RL: f64 = 6_378_100.0;
-pub const EARTH_RADIUS: f64 = EARTH_RADIUS_RL * GAME_SCALE;
+pub const EARTH_RADIUS: f64 = EARTH_RADIUS_RL * GAME_SCALE_DISTANCE;
+pub const EARTH_MASS_RL: f64 = 5972000000000000000000000.0;
+pub const EARTH_MASS: f64 = EARTH_MASS_RL * GAME_SCALE_MASS;
pub const MOON_RADIUS_RL: f64 = 1_737_400.0;
-pub const MOON_RADIUS: f64 = MOON_RADIUS_RL * GAME_SCALE;
+pub const MOON_RADIUS: f64 = MOON_RADIUS_RL * GAME_SCALE_DISTANCE;
+pub const MOON_MASS_RL: f64 = 73476730900000000000000.0;
+pub const MOON_MASS: f64 = MOON_MASS_RL * GAME_SCALE_MASS;
+
pub const MOON_PERIAPSIS: f64 = 5400.0; //363228.9 * 1000.0 * GAME_SCALE; // real values
pub const MOON_APOAPSIS: f64 = 5600.0; //405400.0 * 1000.0 * GAME_SCALE; // real values
-pub const MOON_ORBIT_TIME: f64 = 23328000.0 * GAME_SCALE; // not real values (10x higher)>
\ No newline at end of file
+pub const MOON_ORBIT_TIME: f64 = 23328000.0 * GAME_SCALE_DISTANCE; // not real values (10x higher)<
\ No newline at end of file
@@ 4,7 4,7 @@ use rapier2d_f64::prelude::{RigidBodyHandle, RigidBodySet, ColliderBuilder, Rigi
use starkingdoms_protocol::planet::PlanetType;
use crate::{SCALE, manager::ClientHandlerMessage};
-use crate::orbit::constants::{EARTH_RADIUS, MOON_APOAPSIS, MOON_PERIAPSIS, MOON_RADIUS};
+use crate::orbit::constants::{EARTH_MASS, EARTH_RADIUS, MOON_APOAPSIS, MOON_MASS, MOON_PERIAPSIS, MOON_RADIUS};
use crate::orbit::orbit::{calculate_point_on_orbit, calculate_world_position_of_orbit};
//const GRAVITY: f64 = 0.001;
@@ 69,7 69,7 @@ impl Planets {
&mut planets,
"earth",
PlanetType::Earth,
- 4000.0,
+ EARTH_MASS,
EARTH_RADIUS,
(100.0, 100.0),
rigid_body_set,
@@ 82,7 82,7 @@ impl Planets {
&mut planets,
"moon",
PlanetType::Moon,
- 1000.0,
+ MOON_MASS,
MOON_RADIUS,
(moon_start_point[0], moon_start_point[1]),
rigid_body_set,