Skip to content

Commit

Permalink
Remove unnecessary swizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
Shute052 committed Sep 10, 2024
1 parent 13a3df7 commit b068482
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions examples/twin_stick_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit b068482

Please sign in to comment.