From b068482c74a036640ee3c43182a8fba802f96a95 Mon Sep 17 00:00:00 2001 From: Shute052 Date: Tue, 10 Sep 2024 10:41:48 +0800 Subject: [PATCH] Remove unnecessary swizzle --- examples/twin_stick_controller.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/twin_stick_controller.rs b/examples/twin_stick_controller.rs index 9d13b7b7..743f7410 100644 --- a/examples/twin_stick_controller.rs +++ b/examples/twin_stick_controller.rs @@ -160,14 +160,13 @@ fn control_player( if action_state.axis_pair(&PlayerAction::Move) != Vec2::ZERO { // Note: In a real game we'd feed this into an actual player controller // and respects the camera extrinsics to ensure the direction is correct - let move_delta = - time.delta_seconds() * action_state.clamped_axis_pair(&PlayerAction::Move).xy(); + let move_delta = time.delta_seconds() * action_state.clamped_axis_pair(&PlayerAction::Move); player_transform.translation += Vec3::new(move_delta.x, 0.0, move_delta.y); println!("Player moved to: {}", player_transform.translation.xz()); } if action_state.axis_pair(&PlayerAction::Look) != Vec2::ZERO { - let look = action_state.axis_pair(&PlayerAction::Look).xy().normalize(); + let look = action_state.axis_pair(&PlayerAction::Look).normalize(); println!("Player looking in direction: {}", look); }