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

Upgrade Bevy to 0.15 #594

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b9f3a6f
add example to output a debugdump of postupdate
Vrixyz Aug 8, 2024
ff03180
better multiple sets for propagate transforms
Vrixyz Sep 6, 2024
16c3e3f
allow system race for writeback
Vrixyz Sep 6, 2024
b669fe2
remove ambiguity from example
Vrixyz Sep 6, 2024
2c586e9
Merge remote-tracking branch 'upstream' into debugdump
Vrixyz Sep 10, 2024
310ab56
filter out some less relevant systems
Vrixyz Sep 10, 2024
8e553a8
Merge branch 'debugdump' into system_schedules
Vrixyz Sep 10, 2024
e32c4a6
remove dbg
Vrixyz Sep 10, 2024
ad498ee
Merge branch 'debugdump' into system_schedules
Vrixyz Sep 10, 2024
c7ee449
split joints and colliders out of rapier context
Vrixyz Sep 11, 2024
6beece6
split query pipeline + add a 'RapierContextWhole', designed to be the…
Vrixyz Sep 17, 2024
20c47d8
split rigidbody set
Vrixyz Sep 17, 2024
7519a8c
Merge branch 'master' into split_rapiercontext
Vrixyz Sep 17, 2024
4df1d88
use a RapierContext systemparam for a better API ; rework modules + u…
Vrixyz Sep 19, 2024
6b44512
add some missing doc for systemparams
Vrixyz Sep 20, 2024
7b93dba
remove unnecessary macro + fix clippy + docs
Vrixyz Oct 14, 2024
fe1b49a
use a bundle to create correct rapier context components
Vrixyz Oct 14, 2024
83c795f
Merge branch 'master' into split_rapiercontext
Vrixyz Oct 14, 2024
78dc64e
add an example to access a specific component of RapierContext
Vrixyz Oct 14, 2024
8d78d77
changelog adaptations
Vrixyz Oct 14, 2024
3e98da1
more functions transparent for RapierContext and RapierContextMut
Vrixyz Oct 15, 2024
099719b
update bevy to 0.15, commenting out bevy_egui
Vrixyz Oct 31, 2024
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
29 changes: 19 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,25 @@ which was its hardcoded behaviour.

### Modified

- `RapierContext`, `RapierConfiguration` and `RenderToSimulationTime` are now a `Component` instead of resources.
- Rapier now supports multiple independent physics worlds, see example `multi_world3` for usage details.
- Migration guide:
- `ResMut<mut RapierContext>` -> `WriteDefaultRapierContext`
- `Res<RapierContext>` -> `ReadDefaultRapierContext`
- Access to `RapierConfiguration` and `RenderToSimulationTime` should query for it
on the responsible entity owning the `RenderContext`.
- If you are building a library on top of `bevy_rapier` and would want to support multiple independent physics worlds too,
you can check out the details of [#545](https://github.com/dimforge/bevy_rapier/pull/545)
to get more context and information.
- Rapier now supports multiple independent physics worlds, see example `multi_world3` for usage details.
- `RapierContext`, `RapierConfiguration` and `SimulationToRenderTime` are no longer a resource.
- They have been split in multiple `Component`s:
- `RapierContextColliders`
- `RapierContextJoints`
- `RapierContextSimulation`
- `RapierRigidBodySet`
- `SimulationToRenderTime`
- `RapierConfiguration`
- Migration guide:
- `ResMut<mut RapierContext>` -> `WriteRapierContext`
- `Res<RapierContext>` -> `ReadRapierContext`
- Access to `RapierConfiguration` and `SimulationToRenderTime` should query for it
on the responsible entity owning the `RenderContext`.
- See [`ray_casting`](bevy_rapier3d/examples/ray_casting3.rs) example for a usage example.
- Each entity managed by bevy_rapier has a `RapierContextEntityLink` pointing to the entity containing the components above.
- If you are building a library on top of `bevy_rapier` and would want to support multiple independent physics worlds too,
you can check out the details of [#545](https://github.com/dimforge/bevy_rapier/pull/545)
to find more information.

## v0.27.0 (07 July 2024)

Expand Down
15 changes: 8 additions & 7 deletions bevy_rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,26 @@ headless = []
async-collider = ["bevy/bevy_asset", "bevy/bevy_scene"]

[dependencies]
bevy = { version = "0.14", default-features = false }
nalgebra = { version = "0.33", features = ["convert-glam027"] }
bevy = { version = "0.15.0-rc.2", default-features = false }
nalgebra = { version = "0.33", features = ["convert-glam029"] }
rapier2d = "0.22"
bitflags = "2.4"
log = "0.4"
serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15.0-rc.2", default-features = false, features = [
"x11",
"bevy_state",
"bevy_debug_stepping",
] }
oorandom = "11"
approx = "0.5.1"
glam = { version = "0.27", features = ["approx"] }
bevy-inspector-egui = "0.25.1"
bevy_egui = "0.28.0"
bevy_mod_debugdump = "0.11"
glam = { version = "0.29", features = ["approx"] }
# bevy-inspector-egui = "0.25.1"
# bevy_egui = "0.28.0"
# bevy_mod_debugdump = "0.11"
bevy_mod_debugdump = { git = "https://github.com/andriyDev/bevy_mod_debugdump.git", branch = "bevy-0.15" }

[package.metadata.docs.rs]
# Enable all the features when building the docs on docs.rs
Expand Down
9 changes: 3 additions & 6 deletions bevy_rapier2d/examples/boxes2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ fn main() {
}

pub fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, 20.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, 20.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands) {
Expand All @@ -32,7 +29,7 @@ pub fn setup_physics(mut commands: Commands) {
let ground_height = 10.0;

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, 0.0 * -ground_height, 0.0)),
Transform::from_xyz(0.0, 0.0 * -ground_height, 0.0),
Collider::cuboid(ground_size, ground_height),
));

Expand All @@ -54,7 +51,7 @@ pub fn setup_physics(mut commands: Commands) {
let y = j as f32 * shift + centery + 30.0;

commands.spawn((
TransformBundle::from(Transform::from_xyz(x, y, 0.0)),
Transform::from_xyz(x, y, 0.0),
RigidBody::Dynamic,
Collider::cuboid(rad, rad),
));
Expand Down
11 changes: 4 additions & 7 deletions bevy_rapier2d/examples/contact_filter2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ fn main() {
}

fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, 20.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, 20.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands) {
Expand All @@ -58,13 +55,13 @@ pub fn setup_physics(mut commands: Commands) {
let ground_size = 100.0;

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, -100.0, 0.0)),
Transform::from_xyz(0.0, -100.0, 0.0),
Collider::cuboid(ground_size, 12.0),
CustomFilterTag::GroupA,
));

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, 0.0, 0.0)),
Transform::from_xyz(0.0, 0.0, 0.0),
Collider::cuboid(ground_size, 12.0),
CustomFilterTag::GroupB,
));
Expand All @@ -89,7 +86,7 @@ pub fn setup_physics(mut commands: Commands) {
group_id += 1;

commands.spawn((
TransformBundle::from(Transform::from_xyz(x, y, 0.0)),
Transform::from_xyz(x, y, 0.0),
RigidBody::Dynamic,
Collider::cuboid(rad, rad),
ActiveHooks::FILTER_CONTACT_PAIRS,
Expand Down
9 changes: 3 additions & 6 deletions bevy_rapier2d/examples/custom_system_setup2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ fn despawn_one_box(
}

fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, 20.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, 20.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands) {
Expand All @@ -75,7 +72,7 @@ pub fn setup_physics(mut commands: Commands) {
let ground_height = 10.0;

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, 0.0 * -ground_height, 0.0)),
Transform::from_xyz(0.0, 0.0 * -ground_height, 0.0),
Collider::cuboid(ground_size, ground_height),
));

Expand All @@ -97,7 +94,7 @@ pub fn setup_physics(mut commands: Commands) {
let y = j as f32 * shift + centery + 30.0;

commands.spawn((
TransformBundle::from(Transform::from_xyz(x, y, 0.0)),
Transform::from_xyz(x, y, 0.0),
RigidBody::Dynamic,
Collider::cuboid(rad, rad),
));
Expand Down
24 changes: 9 additions & 15 deletions bevy_rapier2d/examples/debug_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub fn setup_game(mut commands: Commands, mut game: ResMut<Game>) {
byte_rgb(255, 0, 0),
];

commands.spawn(Camera2dBundle::default());
commands.spawn(Camera2d::default());

setup_board(&mut commands, &game);

Expand Down Expand Up @@ -131,15 +131,12 @@ fn setup_board(commands: &mut Commands, game: &Game) {

// Add floor
commands.spawn((
SpriteBundle {
sprite: Sprite {
color: Color::srgb(0.5, 0.5, 0.5),
custom_size: Some(Vec2::new(game.n_lanes as f32 * 30.0, 60.0)),
..Default::default()
},
transform: Transform::from_xyz(0.0, floor_y - 30.0 * 0.5, 0.0),
Sprite {
color: Color::srgb(0.5, 0.5, 0.5),
custom_size: Some(Vec2::new(game.n_lanes as f32 * 30.0, 60.0)),
..Default::default()
},
Transform::from_xyz(0.0, floor_y - 30.0 * 0.5, 0.0),
RigidBody::Fixed,
Collider::cuboid(game.n_lanes as f32 * 30.0 / 2.0, 60.0 / 2.0),
));
Expand Down Expand Up @@ -200,15 +197,12 @@ fn spawn_block(

commands
.spawn((
SpriteBundle {
sprite: Sprite {
color: game.cube_colors[kind as usize],
custom_size: Some(Vec2::new(30.0, 30.0)),
..Default::default()
},
transform: Transform::from_xyz(x, y, 0.0),
Sprite {
color: game.cube_colors[kind as usize],
custom_size: Some(Vec2::new(30.0, 30.0)),
..Default::default()
},
Transform::from_xyz(x, y, 0.0),
RigidBody::Dynamic,
Damping {
linear_damping,
Expand Down
17 changes: 7 additions & 10 deletions bevy_rapier2d/examples/debug_toggle2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ fn main() {
}

pub fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-30.0, 30.0, 100.0)
.looking_at(Vec3::new(0.0, 10.0, 0.0), Vec3::Y),
..Default::default()
});
commands.spawn((
Camera3d::default(),
Transform::from_xyz(-30.0, 30.0, 100.0).looking_at(Vec3::new(0.0, 10.0, 0.0), Vec3::Y),
));
}

#[derive(Component)]
Expand All @@ -49,7 +48,7 @@ pub fn setup_physics(mut commands: Commands) {
let ground_height = 0.1;

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, -ground_height, 0.0)),
Transform::from_xyz(0.0, -ground_height, 0.0),
Collider::cuboid(ground_size, ground_height),
));

Expand Down Expand Up @@ -81,12 +80,10 @@ pub fn setup_physics(mut commands: Commands) {
color += 1;

commands
.spawn(TransformBundle::from(Transform::from_rotation(
Quat::from_rotation_x(0.2),
)))
.spawn(Transform::from_rotation(Quat::from_rotation_x(0.2)))
.with_children(|child| {
child.spawn((
TransformBundle::from(Transform::from_xyz(x, y, z)),
Transform::from_xyz(x, y, z),
RigidBody::Dynamic,
Collider::cuboid(rad, rad),
ColliderDebugColor(colors[color % 3]),
Expand Down
2 changes: 1 addition & 1 deletion bevy_rapier2d/examples/debugdump2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Example using bevy_mod_debugdump to output a graph of systems execution order.
//! run with:
//! `cargo run --example debugdump2 > dump.dot && dot -Tsvg dump.dot > dump.svg`
//! `cargo run --example debugdump2 > dump.dot && dot -Tsvg dump.dot > dump.svg`

use bevy::prelude::*;
use bevy_mod_debugdump::{schedule_graph, schedule_graph_dot};
Expand Down
11 changes: 4 additions & 7 deletions bevy_rapier2d/examples/despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ pub fn setup_graphics(
resize.timer = Timer::from_seconds(6.0, TimerMode::Once);
despawn.timer = Timer::from_seconds(5.0, TimerMode::Once);

commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, 20.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, 20.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands) {
Expand All @@ -58,12 +55,12 @@ pub fn setup_physics(mut commands: Commands) {
commands.spawn((Collider::cuboid(ground_size, 12.0), Despawn));

commands.spawn((
TransformBundle::from(Transform::from_xyz(ground_size, ground_size * 2.0, 0.0)),
Transform::from_xyz(ground_size, ground_size * 2.0, 0.0),
Collider::cuboid(12.0, ground_size * 2.0),
));

commands.spawn((
TransformBundle::from(Transform::from_xyz(-ground_size, ground_size * 2.0, 0.0)),
Transform::from_xyz(-ground_size, ground_size * 2.0, 0.0),
Collider::cuboid(12.0, ground_size * 2.0),
));

Expand All @@ -83,7 +80,7 @@ pub fn setup_physics(mut commands: Commands) {
let y = j as f32 * shift + centery + 2.0;

let mut entity = commands.spawn((
TransformBundle::from(Transform::from_xyz(x, y, 0.0)),
Transform::from_xyz(x, y, 0.0),
RigidBody::Dynamic,
Collider::cuboid(rad, rad),
));
Expand Down
8 changes: 4 additions & 4 deletions bevy_rapier2d/examples/events2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn main() {
}

pub fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle::default());
commands.spawn(Camera2d::default());
}

pub fn display_events(
Expand All @@ -40,18 +40,18 @@ pub fn setup_physics(mut commands: Commands) {
* Ground
*/
commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, -24.0, 0.0)),
Transform::from_xyz(0.0, -24.0, 0.0),
Collider::cuboid(80.0, 20.0),
));

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, 100.0, 0.0)),
Transform::from_xyz(0.0, 100.0, 0.0),
Collider::cuboid(80.0, 30.0),
Sensor,
));

commands.spawn((
TransformBundle::from(Transform::from_xyz(0.0, 260.0, 0.0)),
Transform::from_xyz(0.0, 260.0, 0.0),
RigidBody::Dynamic,
Collider::cuboid(10.0, 10.0),
ActiveEvents::COLLISION_EVENTS,
Expand Down
7 changes: 2 additions & 5 deletions bevy_rapier2d/examples/joints2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ fn main() {
}

pub fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, -200.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, -200.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands) {
Expand All @@ -46,7 +43,7 @@ pub fn setup_physics(mut commands: Commands) {

let child_entity = commands
.spawn((
TransformBundle::from(Transform::from_xyz(fk * shift, -fi * shift, 0.0)),
Transform::from_xyz(fk * shift, -fi * shift, 0.0),
rigid_body,
Collider::cuboid(rad, rad),
))
Expand Down
7 changes: 2 additions & 5 deletions bevy_rapier2d/examples/joints_despawn2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ fn main() {
}

pub fn setup_graphics(mut commands: Commands) {
commands.spawn(Camera2dBundle {
transform: Transform::from_xyz(0.0, -200.0, 0.0),
..default()
});
commands.spawn((Camera2d::default(), Transform::from_xyz(0.0, -200.0, 0.0)));
}

pub fn setup_physics(mut commands: Commands, mut despawn: ResMut<DespawnResource>) {
Expand All @@ -58,7 +55,7 @@ pub fn setup_physics(mut commands: Commands, mut despawn: ResMut<DespawnResource

let child_entity = commands
.spawn((
TransformBundle::from(Transform::from_xyz(fk * shift, -fi * shift, 0.0)),
Transform::from_xyz(fk * shift, -fi * shift, 0.0),
rigid_body,
Collider::cuboid(rad, rad),
))
Expand Down
Loading
Loading