M server/src/handler.rs => server/src/handler.rs +1 -1
@@ 139,7 139,7 @@ pub async fn handle_client(mgr: ClientManager, data: Arc<RwLock<PhysicsData>>, r
.translation(vector![0.0, 2100.0/SCALE])
.build();
let player_collider: Collider = ColliderBuilder::cuboid(25.0 / SCALE, 25.0 / SCALE)
- .mass_properties(MassProperties::new(point![0.0, 0.0], 250.0, 61250.0))
+ .mass_properties(MassProperties::new(point![0.0, 0.0], 125.0, 61250.0))
//.mass(75.0)
.build();
let player_handle = rigid_body_set.insert(player_body);
M server/src/orbit/constants.rs => server/src/orbit/constants.rs +6 -5
@@ 1,6 1,7 @@
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 GAME_SCALE_TIME: f64 = 0.00038580246913580245; // 900 / MOON_ORBIT_TIME_RL
+pub const GAME_SCALE_TIME: f64 = 0.00051440329218107; // 1200 / MOON_ORBIT_TIME_RL
+pub const GAME_ORBITS_ENABLED: bool = true;
pub const EARTH_RADIUS_BIAS: f64 = 1.0;
pub const EARTH_MASS_BIAS: f64 = 1.0;
@@ 11,10 12,10 @@ pub const EARTH_MASS_RL: f64 = 5972000000000000000000000.0;
pub const EARTH_MASS: f64 = EARTH_MASS_RL * GAME_SCALE_MASS * EARTH_MASS_BIAS;
pub const MOON_RADIUS_BIAS: f64 = 1.0;
-pub const MOON_MASS_BIAS: f64 = 1.0;
-pub const MOON_PERIAPSIS_BIAS: f64 = 1.0;
-pub const MOON_APOAPSIS_BIAS: f64 = 1.0;
-pub const MOON_ORBIT_TIME_BIAS: f64 = 1.0;
+pub const MOON_MASS_BIAS: f64 = 10.0;
+pub const MOON_PERIAPSIS_BIAS: f64 = 0.1;
+pub const MOON_APOAPSIS_BIAS: f64 = 0.1;
+pub const MOON_ORBIT_TIME_BIAS: f64 = 0.5;
pub const MOON_RADIUS_RL: f64 = 1_737_400.0;
pub const MOON_RADIUS: f64 = MOON_RADIUS_RL * GAME_SCALE_DISTANCE * MOON_RADIUS_BIAS;
M server/src/timer.rs => server/src/timer.rs +7 -4
@@ 6,7 6,7 @@ use async_std::sync::RwLock;
use async_std::task::sleep;
use starkingdoms_protocol::player::Player;
use crate::{manager::{ClientHandlerMessage, ClientManager, PhysicsData}, SCALE, planet::Planets};
-use crate::orbit::constants::{MOON_APOAPSIS, MOON_ORBIT_TIME, MOON_PERIAPSIS};
+use crate::orbit::constants::{GAME_ORBITS_ENABLED, MOON_APOAPSIS, MOON_ORBIT_TIME, MOON_PERIAPSIS};
use crate::orbit::orbit::{calculate_point_on_orbit, calculate_world_position_of_orbit};
pub const ROTATIONAL_FORCE: f64 = 100.0;
@@ 24,7 24,10 @@ pub async fn timer_main(mgr: ClientManager, physics_data: Arc<RwLock<PhysicsData
let mut physics_data = physics_data.write().await;
// update orbits (but dont, actually, yet)
- {
+ // DO NOT SIMPLIFY EXPRESSION
+ // IT MAY ALWAYS BE TRUE
+ // THATS FINE
+ if GAME_ORBITS_ENABLED {
let mut planets = world_data.write().await;
// update earth (nothing changes, yet)
@@ 32,8 35,8 @@ pub async fn timer_main(mgr: ClientManager, physics_data: Arc<RwLock<PhysicsData
// update moon
let new_moon_position = calculate_world_position_of_orbit(calculate_point_on_orbit(MOON_PERIAPSIS, MOON_APOAPSIS, time / MOON_ORBIT_TIME), new_earth_position);
- //planets.get_planet_mut("moon").unwrap().position = (new_moon_position[0] / SCALE, new_moon_position[1] / SCALE);
- //physics_data.rigid_body_set.get_mut(planets.get_planet_mut("moon").unwrap().body_handle).unwrap().set_position(new_moon_position.into(), true);
+ planets.get_planet_mut("moon").unwrap().position = (new_moon_position[0] / SCALE, new_moon_position[1] / SCALE);
+ physics_data.rigid_body_set.get_mut(planets.get_planet_mut("moon").unwrap().body_handle).unwrap().set_position(new_moon_position.into(), true);
}
physics_data.tick(&mut pipeline);