dynamic camera movement speed limit based on mouse speed

This commit is contained in:
yuni 2024-05-22 23:50:28 +02:00
parent bcba3d0945
commit c56b5d6d74

View file

@ -582,7 +582,10 @@ pub fn apply_input_to_player(
}
}
if pitch_yaw_rot.length_squared() > 1.0e-18 {
let mouse_speed = pitch_yaw_rot.length();
let mouse_moving = mouse_speed > EPSILON32;
if mouse_moving {
play_reactionwheel_sound = true;
pitch_yaw_rot *=
settings.mouse_sensitivity * sensitivity_factor * engine.reaction_wheels;
@ -595,7 +598,7 @@ pub fn apply_input_to_player(
if settings.rotation_stabilizer_active || key_input.pressed(settings.key_stop) {
commands
.entity(player_entity)
.insert(actor::WantsMaxRotation(0.0));
.insert(actor::WantsMaxRotation(mouse_speed as f64 * 0.1));
} else {
commands
.entity(player_entity)