From d5b98644dd0aac5cdf322cb61a58baa65f4283e1 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 31 Mar 2024 03:19:15 +0200 Subject: [PATCH] slow down angular velocity based on reaction wheel speed --- src/camera.rs | 7 +++++-- src/defs.txt | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 4f42158..055e54a 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -246,16 +246,19 @@ fn apply_input_to_player( pitch_yaw_rot[1] -= mouse_delta.x; } } + + let angular_slowdown = 2.0 - engine.reaction_wheels.powf(0.01).clamp(1.001, 1.1); if pitch_yaw_rot.length_squared() > 0.0001 { play_reactionwheel_sound = true; pitch_yaw_rot *= settings.mouse_sensitivity * engine.reaction_wheels; torque.apply_torque(player_transform.rotation * Vec3::new( 2.0*pitch_yaw_rot[0], pitch_yaw_rot[1], pitch_yaw_rot[2])); - angularvelocity.0 *= 0.98; + angularvelocity.0 *= angular_slowdown.clamp(0.97, 1.0); } else { if angularvelocity.length_squared() > 0.0000001 { - angularvelocity.0 *= 0.98; + play_reactionwheel_sound = true; + angularvelocity.0 *= angular_slowdown; } else { angularvelocity.0 = Vec3::splat(0.0); diff --git a/src/defs.txt b/src/defs.txt index 9b58094..c407e25 100644 --- a/src/defs.txt +++ b/src/defs.txt @@ -6,7 +6,7 @@ actor 0 0 0 suit health 0.3 angularmomentum 0 0 0 collider capsule 2 1 - thrust 1.2 1 1 100 1.5 + thrust 1.2 1 1 300 1.5 rotationy 0.65 engine monopropellant @@ -134,7 +134,7 @@ actor -3300 10 0 pizzeria actor 10 -30 20 MeteorAceGT scale 5 vehicle yes - thrust 70 13.7 9.4 50000 20 + thrust 70 13.7 9.4 200000 20 engine ion collider sphere 1.5 camdistance 50