diff --git a/src/camera.rs b/src/camera.rs index 43e6640..f32098b 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -28,7 +28,6 @@ pub const RADIANS_PER_DOT: f32 = 1.0 / 180.0; pub struct CameraController { pub enabled: bool, pub initialized: bool, - pub sensitivity: f32, pub pitch: f32, pub yaw: f32, } @@ -38,7 +37,6 @@ impl Default for CameraController { Self { enabled: true, initialized: false, - sensitivity: 0.5, pitch: 1.0, // pitch=0/yaw=0 -> face sun yaw: 0.3, } @@ -245,9 +243,9 @@ fn run_camera_controller( if mouse_delta != Vec2::ZERO { // Apply look update controller.pitch = (controller.pitch - + mouse_delta.y * RADIANS_PER_DOT * controller.sensitivity) + + mouse_delta.y * RADIANS_PER_DOT * settings.mouse_sensitivity) .clamp(-PI / 2., PI / 2.); - controller.yaw += mouse_delta.x * RADIANS_PER_DOT * controller.sensitivity; + controller.yaw += mouse_delta.x * RADIANS_PER_DOT * settings.mouse_sensitivity; player_transform.rotation = Quat::from_euler(EulerRot::ZYX, 0.0, -controller.yaw, controller.pitch).normalize(); } diff --git a/src/settings.rs b/src/settings.rs index bb18ed8..6a9e6d3 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -7,6 +7,7 @@ pub struct Settings { pub mute_music: bool, pub volume_sfx: u8, pub volume_music: u8, + pub mouse_sensitivity: f32, pub font_size_hud: f32, pub font_size_conversations: f32, pub hud_active: bool, @@ -55,6 +56,7 @@ impl Default for Settings { mute_music: default_mute_music, volume_sfx: 100, volume_music: 100, + mouse_sensitivity: 0.5, font_size_hud: 32.0, font_size_conversations: 32.0, hud_active: false,