From ead1da1690213f60711d1364acd40300d5c35d19 Mon Sep 17 00:00:00 2001 From: person93 Date: Tue, 14 Jan 2025 10:30:05 -0500 Subject: [PATCH 1/3] Deprecate rapier IO bundles --- rapier2d/src/lib.rs | 6 ++++++ rapier3d/src/lib.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/rapier2d/src/lib.rs b/rapier2d/src/lib.rs index d7af98f70..89f316fdd 100644 --- a/rapier2d/src/lib.rs +++ b/rapier2d/src/lib.rs @@ -47,6 +47,9 @@ impl Default for TnuaRapier2dPlugin { impl Plugin for TnuaRapier2dPlugin { fn build(&self, app: &mut App) { + app.register_required_components::() + .register_required_components::() + .register_required_components::(); app.configure_sets( self.schedule, TnuaSystemSet.before(PhysicsSet::SyncBackend).run_if( @@ -70,6 +73,9 @@ impl Plugin for TnuaRapier2dPlugin { /// `bevy_rapier2d`-specific components required for Tnua to work. #[derive(Bundle, Default)] +#[deprecated( + note = "All uses can be safely removed, components are added via bevy's required components" +)] pub struct TnuaRapier2dIOBundle { pub velocity: Velocity, pub external_force: ExternalForce, diff --git a/rapier3d/src/lib.rs b/rapier3d/src/lib.rs index 7ba9660fa..b5fc7f370 100644 --- a/rapier3d/src/lib.rs +++ b/rapier3d/src/lib.rs @@ -47,6 +47,9 @@ impl Default for TnuaRapier3dPlugin { impl Plugin for TnuaRapier3dPlugin { fn build(&self, app: &mut App) { + app.register_required_components::() + .register_required_components::() + .register_required_components::(); app.configure_sets( self.schedule, TnuaSystemSet.before(PhysicsSet::SyncBackend).run_if( @@ -70,6 +73,9 @@ impl Plugin for TnuaRapier3dPlugin { /// `bevy_rapier3d`-specific components required for Tnua to work. #[derive(Bundle, Default)] +#[deprecated( + note = "All uses can be safely removed, components are added via bevy's required components" +)] pub struct TnuaRapier3dIOBundle { pub velocity: Velocity, pub external_force: ExternalForce, From 774540a3408c8da27f0e92cfdc51022636a19a43 Mon Sep 17 00:00:00 2001 From: person93 Date: Tue, 14 Jan 2025 10:49:54 -0500 Subject: [PATCH 2/3] Stop using rapier IO bundles in examples and demos --- demos/src/bin/platformer_2d.rs | 4 ---- demos/src/bin/platformer_3d.rs | 4 ---- demos/src/bin/shooter_like.rs | 4 ---- examples/example.rs | 1 - examples/example_animating.rs | 1 - 5 files changed, 14 deletions(-) diff --git a/demos/src/bin/platformer_2d.rs b/demos/src/bin/platformer_2d.rs index 18d20e73c..22a1db0b4 100644 --- a/demos/src/bin/platformer_2d.rs +++ b/demos/src/bin/platformer_2d.rs @@ -165,15 +165,11 @@ fn setup_player(mut commands: Commands) { { cmd.insert(rapier::RigidBody::Dynamic); cmd.insert(rapier::Collider::capsule_y(0.5, 0.5)); - // For Rapier, an "IO" bundle needs to be added so that Tnua will have all the components - // it needs to interact with Rapier. - cmd.insert(TnuaRapier2dIOBundle::default()); } #[cfg(feature = "avian2d")] { cmd.insert(avian::RigidBody::Dynamic); cmd.insert(avian::Collider::capsule(0.5, 1.0)); - // Avian does not need an "IO" bundle. } // `TnuaController` is Tnua's main interface with the user code. Read diff --git a/demos/src/bin/platformer_3d.rs b/demos/src/bin/platformer_3d.rs index b8315f8c3..822b913ed 100644 --- a/demos/src/bin/platformer_3d.rs +++ b/demos/src/bin/platformer_3d.rs @@ -177,15 +177,11 @@ fn setup_player(mut commands: Commands, asset_server: Res) { { cmd.insert(rapier::RigidBody::Dynamic); cmd.insert(rapier::Collider::capsule_y(0.5, 0.5)); - // For Rapier, an "IO" bundle needs to be added so that Tnua will have all the components - // it needs to interact with Rapier. - cmd.insert(TnuaRapier3dIOBundle::default()); } #[cfg(feature = "avian3d")] { cmd.insert(avian::RigidBody::Dynamic); cmd.insert(avian::Collider::capsule(0.5, 1.0)); - // Avian does not need an "IO" bundle. } // `TnuaController` is Tnua's main interface with the user code. Read diff --git a/demos/src/bin/shooter_like.rs b/demos/src/bin/shooter_like.rs index dd068f337..7a8e96fa2 100644 --- a/demos/src/bin/shooter_like.rs +++ b/demos/src/bin/shooter_like.rs @@ -180,15 +180,11 @@ fn setup_player(mut commands: Commands, asset_server: Res) { { cmd.insert(rapier::RigidBody::Dynamic); cmd.insert(rapier::Collider::capsule_y(0.5, 0.5)); - // For Rapier, an "IO" bundle needs to be added so that Tnua will have all the components - // it needs to interact with Rapier. - cmd.insert(TnuaRapier3dIOBundle::default()); } #[cfg(feature = "avian3d")] { cmd.insert(avian::RigidBody::Dynamic); cmd.insert(avian::Collider::capsule(0.5, 1.0)); - // Avian does not need an "IO" bundle. } // `TnuaController` is Tnua's main interface with the user code. Read diff --git a/examples/example.rs b/examples/example.rs index 41f1b24e8..fdda1cf2d 100644 --- a/examples/example.rs +++ b/examples/example.rs @@ -94,7 +94,6 @@ fn setup_player( // By locking the rotation we can prevent this. LockedAxes::ROTATION_LOCKED, )); - // NOTE: if this was Rapier, we'd also need `TnuaRapier3dIOBundle`. Avian does not need it. } fn apply_controls(keyboard: Res>, mut query: Query<&mut TnuaController>) { diff --git a/examples/example_animating.rs b/examples/example_animating.rs index ca3594e3d..b717d1cc7 100644 --- a/examples/example_animating.rs +++ b/examples/example_animating.rs @@ -119,7 +119,6 @@ fn setup_player(mut commands: Commands, asset_server: Res) { // By locking the rotation we can prevent this. LockedAxes::ROTATION_LOCKED.unlock_rotation_y(), )); - // NOTE: if this was Rapier, we'd also need `TnuaRapier3dIOBundle`. Avian does not need it. } // No Tnua-related setup here - this is just for dealing with Bevy's animation graph. From 153e9fb91dc0e86138fa424535c2f52a8bdbe276 Mon Sep 17 00:00:00 2001 From: person93 Date: Tue, 14 Jan 2025 15:09:34 -0500 Subject: [PATCH 3/3] Update rapier3d changelog --- rapier3d/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rapier3d/CHANGELOG.md b/rapier3d/CHANGELOG.md index 5322a4177..c33ec08cf 100644 --- a/rapier3d/CHANGELOG.md +++ b/rapier3d/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. NOTE: This changelog is shared between bevy-tnua-rapier2d and bevy-tnua-rapier3d. ## [Unreleased] +### Deprecated +- Deprecate `TnuaRapier3dIOBundle` in favor or bevy required components. ## 0.9.0 - 2024-12-13 ### Changed