Tweak sync queries to include positions for which rigid body/collider positions aren't automatically synced by Rapier.

This commit is contained in:
Nolan Darilek 2021-07-28 09:36:50 -05:00
parent 7f61eb3a90
commit 7fe808b2a1

View File

@ -563,7 +563,9 @@ fn copy_coordinates_to_transform(
(
Changed<Transform>,
Without<RigidBodyPosition>,
Without<RigidBodyPositionSync>,
Without<ColliderPosition>,
Without<ColliderPositionSync>,
),
>,
) {
@ -580,7 +582,10 @@ fn copy_coordinates_to_transform(
}
fn copy_rigid_body_position_to_coordinates(
mut query: Query<(&mut Coordinates, &RigidBodyPosition), Changed<RigidBodyPosition>>,
mut query: Query<
(&mut Coordinates, &RigidBodyPosition),
(Changed<RigidBodyPosition>, With<RigidBodyPositionSync>),
>,
) {
for (mut coordinates, position) in query.iter_mut() {
if coordinates.0 .0 != position.position.translation.x {
@ -595,7 +600,11 @@ fn copy_rigid_body_position_to_coordinates(
fn copy_collider_position_to_coordinates(
mut query: Query<
(&mut Coordinates, &ColliderPosition),
(Without<RigidBodyPosition>, Changed<ColliderPosition>),
(
Without<RigidBodyPosition>,
Changed<ColliderPosition>,
With<ColliderPositionSync>,
),
>,
) {
for (mut coordinates, position) in query.iter_mut() {