From e834d94b8ae23733e727ae26b4dc586ffe367864 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Sat, 9 Aug 2025 15:08:15 -0500 Subject: [PATCH] Use `Transform` not `Position` in wrapping system --- src/physics.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/physics.rs b/src/physics.rs index 9adb4c4..f7eca79 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -45,7 +45,7 @@ pub(crate) fn apply_rotation_to_mesh(mut query: Query<(&mut Transform, &Rotation } pub(crate) fn wrap_entities( - mut query: Query<&mut Position, With>, + mut query: Query<&mut Transform, With>, world_size: Res, ) { let right = world_size.width / 2.0; @@ -54,16 +54,16 @@ pub(crate) fn wrap_entities( let bottom = -top; for mut pos in query.iter_mut() { - if pos.0.x > right { - pos.0.x = left; - } else if pos.0.x < left { - pos.0.x = right; + if pos.translation.x > right { + pos.translation.x = left; + } else if pos.translation.x < left { + pos.translation.x = right; } - if pos.0.y > top { - pos.0.y = bottom; - } else if pos.0.y < bottom { - pos.0.y = top; + if pos.translation.y > top { + pos.translation.y = bottom; + } else if pos.translation.y < bottom { + pos.translation.y = top; } } }