slow down angular velocity based on reaction wheel speed

This commit is contained in:
yuni 2024-03-31 03:19:15 +02:00
parent 2411430799
commit d5b98644dd
2 changed files with 7 additions and 4 deletions

View file

@ -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);

View file

@ -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