Avoid unnecessary coordinate changes.
This commit is contained in:
parent
2635dcbb9c
commit
3994c1c744
|
@ -565,12 +565,16 @@ 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)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user