Avoid unnecessary coordinate changes.

This commit is contained in:
Nolan Darilek 2021-06-09 17:24:56 -05:00
parent 2635dcbb9c
commit 3994c1c744

View File

@ -565,11 +565,15 @@ fn copy_coordinates_to_transform(
}
fn copy_rigid_body_position_to_coordinates(
mut query: Query<(&mut Coordinates, &RigidBodyPosition)>,
mut query: Query<(&mut Coordinates, &RigidBodyPosition), Changed<RigidBodyPosition>>,
) {
for (mut coordinates, position) in query.iter_mut() {
coordinates.0 .0 = position.position.translation.x;
coordinates.0 .1 = position.position.translation.y;
if coordinates.0 .0 != position.position.translation.x {
coordinates.0 .0 = position.position.translation.x;
}
if coordinates.0 .1 != position.position.translation.y {
coordinates.0 .1 = position.position.translation.y;
}
}
}