From 86ce38eda187eb6706e66f7401b38e498d8fc027 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 11 Apr 2024 21:42:42 +0200 Subject: [PATCH] experiment: mute reaction wheels, unless inside vehicle --- src/camera.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/camera.rs b/src/camera.rs index 359fd5e..725a80a 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -176,6 +176,7 @@ pub fn apply_input_to_player( &mut AngularVelocity, &mut LinearVelocity, &mut ExternalTorque, + Option<&actor::PlayerDrivesThis>, ), (With, Without)>, ) { let dt = time.delta_seconds(); @@ -200,7 +201,7 @@ pub fn apply_input_to_player( DVec3::splat(0.0) }; - if let Ok((player_transform, mut engine, mut angularvelocity, mut v, mut torque)) = q_playercam.get_single_mut() { + if let Ok((player_transform, mut engine, mut angularvelocity, mut v, mut torque, bike)) = q_playercam.get_single_mut() { // Handle key input if focused { if key_input.pressed(settings.key_forward) { @@ -335,7 +336,7 @@ pub fn apply_input_to_player( let volume = sink.volume(); let speed = sink.speed(); let action = pitch_yaw_rot.length_squared().powf(0.2) * 0.0005; - if play_reactionwheel_sound && !settings.mute_sfx { + if play_reactionwheel_sound && !settings.mute_sfx && bike.is_some() { sink.set_volume((volume + action).clamp(0.0, 1.0)); sink.set_speed((speed + action * 0.2).clamp(0.2, 0.5)); sink.play()