Skip to content

Commit

Permalink
Merge pull request #80 from Person-93/deprecate-io-bundles
Browse files Browse the repository at this point in the history
Deprecate rapier io bundles
  • Loading branch information
idanarye authored Jan 14, 2025
2 parents 3be4684 + 153e9fb commit 950e903
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions demos/src/bin/platformer_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions demos/src/bin/platformer_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,11 @@ fn setup_player(mut commands: Commands, asset_server: Res<AssetServer>) {
{
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
Expand Down
4 changes: 0 additions & 4 deletions demos/src/bin/shooter_like.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,11 @@ fn setup_player(mut commands: Commands, asset_server: Res<AssetServer>) {
{
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
Expand Down
1 change: 0 additions & 1 deletion examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ButtonInput<KeyCode>>, mut query: Query<&mut TnuaController>) {
Expand Down
1 change: 0 additions & 1 deletion examples/example_animating.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ fn setup_player(mut commands: Commands, asset_server: Res<AssetServer>) {
// 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.
Expand Down
6 changes: 6 additions & 0 deletions rapier2d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ impl Default for TnuaRapier2dPlugin {

impl Plugin for TnuaRapier2dPlugin {
fn build(&self, app: &mut App) {
app.register_required_components::<TnuaProximitySensor, Velocity>()
.register_required_components::<TnuaProximitySensor, ExternalForce>()
.register_required_components::<TnuaProximitySensor, ReadMassProperties>();
app.configure_sets(
self.schedule,
TnuaSystemSet.before(PhysicsSet::SyncBackend).run_if(
Expand All @@ -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 {

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier2d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier2dIOBundle { | ^^^^^^^^^^^^^^^^^^^^

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier2d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier2dIOBundle { | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier2d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier2dIOBundle { | ^^^^^^^^^^^^^^^^^^^^

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier2d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier2dIOBundle { | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / Docs

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components

Check warning on line 79 in rapier2d/src/lib.rs

View workflow job for this annotation

GitHub Actions / Docs

use of deprecated struct `TnuaRapier2dIOBundle`: All uses can be safely removed, components are added via bevy's required components
pub velocity: Velocity,
pub external_force: ExternalForce,
Expand Down
2 changes: 2 additions & 0 deletions rapier3d/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions rapier3d/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ impl Default for TnuaRapier3dPlugin {

impl Plugin for TnuaRapier3dPlugin {
fn build(&self, app: &mut App) {
app.register_required_components::<TnuaProximitySensor, Velocity>()
.register_required_components::<TnuaProximitySensor, ExternalForce>()
.register_required_components::<TnuaProximitySensor, ReadMassProperties>();
app.configure_sets(
self.schedule,
TnuaSystemSet.before(PhysicsSet::SyncBackend).run_if(
Expand All @@ -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 {

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier3d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier3dIOBundle { | ^^^^^^^^^^^^^^^^^^^^

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier3d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier3dIOBundle { | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier3d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier3dIOBundle { | ^^^^^^^^^^^^^^^^^^^^

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / clippy

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components

warning: use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components --> rapier3d/src/lib.rs:79:12 | 79 | pub struct TnuaRapier3dIOBundle { | ^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(deprecated)]` on by default

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / Docs

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components

Check warning on line 79 in rapier3d/src/lib.rs

View workflow job for this annotation

GitHub Actions / Docs

use of deprecated struct `TnuaRapier3dIOBundle`: All uses can be safely removed, components are added via bevy's required components
pub velocity: Velocity,
pub external_force: ExternalForce,
Expand Down

0 comments on commit 950e903

Please sign in to comment.