Avoid unnecessary coordinate changes.
This commit is contained in:
parent
2635dcbb9c
commit
3994c1c744
10
src/core.rs
10
src/core.rs
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user