From 9d59f8b283e8a4d84c1909a750d0e789de866c6a Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 25 Nov 2024 23:44:22 +0100 Subject: refactor(engine): compare key states with == in fly camera --- engine/src/camera/fly.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engine/src/camera/fly.rs') diff --git a/engine/src/camera/fly.rs b/engine/src/camera/fly.rs index 1333360..99739e3 100644 --- a/engine/src/camera/fly.rs +++ b/engine/src/camera/fly.rs @@ -121,23 +121,23 @@ fn update( camera.global_up = cam_right.cross(&direction).normalize(); - if matches!(keys.get_key_state(Key::W), KeyState::Pressed) { + if keys.get_key_state(Key::W) == KeyState::Pressed { camera_pos.position += direction * fly_camera.speed * delta_time.as_secs_f32(); } - if matches!(keys.get_key_state(Key::S), KeyState::Pressed) { + if keys.get_key_state(Key::S) == KeyState::Pressed { camera_pos.position -= direction * fly_camera.speed * delta_time.as_secs_f32(); } - if matches!(keys.get_key_state(Key::A), KeyState::Pressed) { + if keys.get_key_state(Key::A) == KeyState::Pressed { let cam_left = -direction.cross(&Vec3::UP).normalize(); camera_pos.position += cam_left * fly_camera.speed * delta_time.as_secs_f32(); } - if matches!(keys.get_key_state(Key::D), KeyState::Pressed) { + if keys.get_key_state(Key::D) == KeyState::Pressed { let cam_right = direction.cross(&Vec3::UP).normalize(); camera_pos.position += -- cgit v1.2.3-18-g5258