From 2f7dcfabc86410f6f7887d22876704fc6751e943 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 2 May 2024 02:07:49 +0200 Subject: [PATCH] if not locked dont move camera --- kubi/src/player_controller.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kubi/src/player_controller.rs b/kubi/src/player_controller.rs index bd0fbc7..a32cbf6 100644 --- a/kubi/src/player_controller.rs +++ b/kubi/src/player_controller.rs @@ -2,7 +2,7 @@ use glam::{vec3, EulerRot, Mat4, Quat, Vec2, Vec2Swizzles, Vec3, Vec3Swizzles}; use shipyard::{track, Component, Get, IntoIter, IntoWithId, IntoWorkload, Unique, UniqueView, View, ViewMut, Workload}; use winit::keyboard::KeyCode; use std::f32::consts::PI; -use crate::{client_physics::ClPhysicsActor, delta_time::DeltaTime, input::{Inputs, PrevInputs, RawKbmInputState}, settings::GameSettings, transform::Transform}; +use crate::{client_physics::ClPhysicsActor, cursor_lock::CursorLock, delta_time::DeltaTime, input::{Inputs, PrevInputs, RawKbmInputState}, settings::GameSettings, transform::Transform}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum PlayerControllerType { @@ -43,7 +43,10 @@ fn update_look( inputs: UniqueView, settings: UniqueView, dt: UniqueView, + lock: UniqueView, ) { + //Only update if the cursor is locked + if !lock.0 { return } let look = inputs.look * settings.mouse_sensitivity * dt.0.as_secs_f32(); if look == Vec2::ZERO { return } for (_, mut transform) in (&controllers, &mut transforms).iter() {