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,13 +565,17 @@ fn copy_coordinates_to_transform(
} }
fn copy_rigid_body_position_to_coordinates( 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() { for (mut coordinates, position) in query.iter_mut() {
if coordinates.0 .0 != position.position.translation.x {
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; coordinates.0 .1 = position.position.translation.y;
} }
} }
}
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub struct CoreConfig { pub struct CoreConfig {