Snapping shouldn't happen continuously.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3fc74d10d9
commit
526f4347a5
|
@ -250,7 +250,7 @@ fn snap(
|
||||||
for (entity, actions, mut transform, direction) in &mut query {
|
for (entity, actions, mut transform, direction) in &mut query {
|
||||||
if snap_timers.contains_key(&entity) {
|
if snap_timers.contains_key(&entity) {
|
||||||
continue;
|
continue;
|
||||||
} else if actions.pressed(NavigationAction::SnapLeft) {
|
} else if actions.just_pressed(NavigationAction::SnapLeft) {
|
||||||
snap_timers.insert(entity, SnapTimer::default());
|
snap_timers.insert(entity, SnapTimer::default());
|
||||||
transform.rotation = Quat::from_rotation_z(match direction {
|
transform.rotation = Quat::from_rotation_z(match direction {
|
||||||
CardinalDirection::North => PI,
|
CardinalDirection::North => PI,
|
||||||
|
@ -258,7 +258,7 @@ fn snap(
|
||||||
CardinalDirection::South => 0.,
|
CardinalDirection::South => 0.,
|
||||||
CardinalDirection::West => -PI / 2.,
|
CardinalDirection::West => -PI / 2.,
|
||||||
});
|
});
|
||||||
} else if actions.pressed(NavigationAction::SnapRight) {
|
} else if actions.just_pressed(NavigationAction::SnapRight) {
|
||||||
snap_timers.insert(entity, SnapTimer::default());
|
snap_timers.insert(entity, SnapTimer::default());
|
||||||
transform.rotation = Quat::from_rotation_z(match direction {
|
transform.rotation = Quat::from_rotation_z(match direction {
|
||||||
CardinalDirection::North => 0.,
|
CardinalDirection::North => 0.,
|
||||||
|
@ -266,10 +266,10 @@ fn snap(
|
||||||
CardinalDirection::South => PI,
|
CardinalDirection::South => PI,
|
||||||
CardinalDirection::West => PI / 2.,
|
CardinalDirection::West => PI / 2.,
|
||||||
});
|
});
|
||||||
} else if actions.pressed(NavigationAction::SnapReverse) {
|
} else if actions.just_pressed(NavigationAction::SnapReverse) {
|
||||||
snap_timers.insert(entity, SnapTimer::default());
|
snap_timers.insert(entity, SnapTimer::default());
|
||||||
transform.rotate(Quat::from_rotation_z(PI));
|
transform.rotate(Quat::from_rotation_z(PI));
|
||||||
} else if actions.pressed(NavigationAction::SnapCardinal) {
|
} else if actions.just_pressed(NavigationAction::SnapCardinal) {
|
||||||
let yaw: Angle = direction.into();
|
let yaw: Angle = direction.into();
|
||||||
let yaw = yaw.radians();
|
let yaw = yaw.radians();
|
||||||
transform.rotation = Quat::from_rotation_z(yaw);
|
transform.rotation = Quat::from_rotation_z(yaw);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user