From b34f1a94b180d65e6c7b40c496919ae6b75b1a73 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 15 Feb 2024 01:54:31 +0100 Subject: [PATCH] fix ctl speed --- kubi/src/player_controller.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kubi/src/player_controller.rs b/kubi/src/player_controller.rs index 6b1c949..402e4ce 100644 --- a/kubi/src/player_controller.rs +++ b/kubi/src/player_controller.rs @@ -64,11 +64,11 @@ fn update_movement( ) { if inputs.movement == Vec2::ZERO { return } let movement = inputs.movement * dt.0.as_secs_f32(); - for (_, mut transform) in (&controllers, &mut transforms).iter() { + for (ctl, mut transform) in (&controllers, &mut transforms).iter() { let (scale, rotation, mut translation) = transform.0.to_scale_rotation_translation(); let rotation_norm = rotation.normalize(); - translation += (rotation_norm * Vec3::NEG_Z).normalize() * movement.y; - translation += (rotation_norm * Vec3::X).normalize() * movement.x; + translation += (rotation_norm * Vec3::NEG_Z).normalize() * movement.y * ctl.speed; + translation += (rotation_norm * Vec3::X).normalize() * movement.x * ctl.speed; transform.0 = Mat4::from_scale_rotation_translation(scale, rotation_norm, translation); } }