use unwrap

This commit is contained in:
luckyturtledev 2024-07-10 17:27:22 +02:00
parent 889b175daf
commit edfb0be3c6

View file

@ -43,10 +43,8 @@ fn move_player(
direction.x -= 1.0;
}
if direction != Vec3::ZERO {
if let Ok(mut player_transform) = q_player.get_single_mut() {
player_transform.translation +=
direction.normalize() * PLAYER_SPEED * time.delta_seconds();
}
let mut player_transform = q_player.get_single_mut().unwrap();
player_transform.translation += direction.normalize() * PLAYER_SPEED * time.delta_seconds();
}
}