Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate rapier io bundles #80

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
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 {
pub velocity: Velocity,
pub external_force: ExternalForce,
Expand Down