From bbd0b2b25487dd157615bb8444fdc7b514d7fe79 Mon Sep 17 00:00:00 2001 From: Joona Aalto Date: Fri, 2 Feb 2024 22:23:10 +0200 Subject: [PATCH] Remove `apply_deferred` --- .../examples/dynamic_character_2d/plugin.rs | 1 - .../examples/kinematic_character_2d/plugin.rs | 1 - crates/bevy_xpbd_2d/examples/sensor.rs | 1 - .../examples/dynamic_character_3d/plugin.rs | 1 - .../examples/kinematic_character_3d/plugin.rs | 1 - src/plugins/prepare.rs | 21 +++++-------------- 6 files changed, 5 insertions(+), 21 deletions(-) diff --git a/crates/bevy_xpbd_2d/examples/dynamic_character_2d/plugin.rs b/crates/bevy_xpbd_2d/examples/dynamic_character_2d/plugin.rs index 661624a8..cdf3193b 100644 --- a/crates/bevy_xpbd_2d/examples/dynamic_character_2d/plugin.rs +++ b/crates/bevy_xpbd_2d/examples/dynamic_character_2d/plugin.rs @@ -11,7 +11,6 @@ impl Plugin for CharacterControllerPlugin { keyboard_input, gamepad_input, update_grounded, - apply_deferred, movement, apply_movement_damping, ) diff --git a/crates/bevy_xpbd_2d/examples/kinematic_character_2d/plugin.rs b/crates/bevy_xpbd_2d/examples/kinematic_character_2d/plugin.rs index 437b4573..29ea6dab 100644 --- a/crates/bevy_xpbd_2d/examples/kinematic_character_2d/plugin.rs +++ b/crates/bevy_xpbd_2d/examples/kinematic_character_2d/plugin.rs @@ -12,7 +12,6 @@ impl Plugin for CharacterControllerPlugin { keyboard_input, gamepad_input, update_grounded, - apply_deferred, apply_gravity, movement, apply_movement_damping, diff --git a/crates/bevy_xpbd_2d/examples/sensor.rs b/crates/bevy_xpbd_2d/examples/sensor.rs index 6071ddff..77e16e48 100644 --- a/crates/bevy_xpbd_2d/examples/sensor.rs +++ b/crates/bevy_xpbd_2d/examples/sensor.rs @@ -14,7 +14,6 @@ fn main() { ( keyboard_input1, keyboard_input2, - apply_deferred, movement.run_if(has_movement), // don't mutably access the character if there is no movement apply_movement_damping, apply_pressure_plate_colour, diff --git a/crates/bevy_xpbd_3d/examples/dynamic_character_3d/plugin.rs b/crates/bevy_xpbd_3d/examples/dynamic_character_3d/plugin.rs index 353152d7..450db1b6 100644 --- a/crates/bevy_xpbd_3d/examples/dynamic_character_3d/plugin.rs +++ b/crates/bevy_xpbd_3d/examples/dynamic_character_3d/plugin.rs @@ -11,7 +11,6 @@ impl Plugin for CharacterControllerPlugin { keyboard_input, gamepad_input, update_grounded, - apply_deferred, movement, apply_movement_damping, ) diff --git a/crates/bevy_xpbd_3d/examples/kinematic_character_3d/plugin.rs b/crates/bevy_xpbd_3d/examples/kinematic_character_3d/plugin.rs index 531b9111..90049c4e 100644 --- a/crates/bevy_xpbd_3d/examples/kinematic_character_3d/plugin.rs +++ b/crates/bevy_xpbd_3d/examples/kinematic_character_3d/plugin.rs @@ -12,7 +12,6 @@ impl Plugin for CharacterControllerPlugin { keyboard_input, gamepad_input, update_grounded, - apply_deferred, apply_gravity, movement, apply_movement_damping, diff --git a/src/plugins/prepare.rs b/src/plugins/prepare.rs index 8aebef85..eb8d54f9 100644 --- a/src/plugins/prepare.rs +++ b/src/plugins/prepare.rs @@ -103,17 +103,13 @@ impl Plugin for PreparePlugin { .register_type::() .add_systems( self.schedule, + // Run transform propagation if new bodies or colliders have been added ( - apply_deferred, - // Run transform propagation if new bodies or colliders have been added - ( - bevy::transform::systems::sync_simple_transforms, - bevy::transform::systems::propagate_transforms, - ) - .chain() - .run_if(any_new_physics_entities), + bevy::transform::systems::sync_simple_transforms, + bevy::transform::systems::propagate_transforms, ) .chain() + .run_if(any_new_physics_entities) .in_set(PrepareSet::PropagateTransforms), ) .add_systems( @@ -126,12 +122,7 @@ impl Plugin for PreparePlugin { ) .add_systems( self.schedule, - ( - init_colliders, - apply_deferred, - update_collider_parents, - apply_deferred, - ) + (init_colliders, update_collider_parents) .chain() .in_set(PrepareSet::InitColliders), ) @@ -151,8 +142,6 @@ impl Plugin for PreparePlugin { update_mass_properties, clamp_collider_density, clamp_restitution, - // All the components we added above must exist before we can simulate the bodies. - apply_deferred, ) .chain() .in_set(PrepareSet::Finalize),