diff --git a/docs-examples/2d/bevy/Cargo.toml b/docs-examples/2d/bevy/Cargo.toml index 5ea0ab4..4897207 100644 --- a/docs-examples/2d/bevy/Cargo.toml +++ b/docs-examples/2d/bevy/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] bevy = "0.15" -bevy_rapier2d = "0.28" +bevy_rapier2d = "0.29" diff --git a/docs-examples/2d/bevy/examples/advanced_collision_detection2.rs b/docs-examples/2d/bevy/examples/advanced_collision_detection2.rs index 78c8aae..7714418 100644 --- a/docs-examples/2d/bevy/examples/advanced_collision_detection2.rs +++ b/docs-examples/2d/bevy/examples/advanced_collision_detection2.rs @@ -72,7 +72,10 @@ fn display_events( // DOCUSAURUS: Events stop // DOCUSAURUS: ContactGraph1 start -fn display_contact_info(rapier_context: ReadDefaultRapierContext, custom_info: Res) { +fn display_contact_info(rapier_context: ReadRapierContext, custom_info: Res) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let entity1 = custom_info.entity1; // A first entity with a collider attached. let entity2 = custom_info.entity2; // A second entity with a collider attached. @@ -119,9 +122,12 @@ fn display_contact_info(rapier_context: ReadDefaultRapierContext, custom_info: R // DOCUSAURUS: ContactGraph2 start fn display_contact_info_all_from_1_entity( - rapier_context: ReadDefaultRapierContext, + rapier_context: ReadRapierContext, custom_info: Res, ) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let entity = custom_info.entity2; // An entity with a collider attached. /* Iterate through all the contact pairs involving a specific collider. */ @@ -139,10 +145,10 @@ fn display_contact_info_all_from_1_entity( // DOCUSAURUS: ContactGraph2 stop // DOCUSAURUS: IntersectionGraph1 start -fn display_intersection_info( - rapier_context: ReadDefaultRapierContext, - custom_info: Res, -) { +fn display_intersection_info(rapier_context: ReadRapierContext, custom_info: Res) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let entity1 = custom_info.entity1; // A first entity with a collider attached. let entity2 = custom_info.entity2; // A second entity with a collider attached. @@ -158,9 +164,12 @@ fn display_intersection_info( // DOCUSAURUS: IntersectionGraph2 start fn display_intersection_info_all_from_1_entity( - rapier_context: ReadDefaultRapierContext, + rapier_context: ReadRapierContext, custom_info: Res, ) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let entity = custom_info.entity2; // An entity with a collider attached. /* Iterate through all the intersection pairs involving a specific collider. */ diff --git a/docs-examples/2d/bevy/examples/multiple_contexts.rs b/docs-examples/2d/bevy/examples/multiple_contexts.rs index a2657dd..e72d7dd 100644 --- a/docs-examples/2d/bevy/examples/multiple_contexts.rs +++ b/docs-examples/2d/bevy/examples/multiple_contexts.rs @@ -33,7 +33,12 @@ fn main() { fn create_contexts(mut commands: Commands) { for i in 0..N_CONTEXTS { // DOCUSAURUS: MultipleContexts_new start - let mut context = commands.spawn(RapierContext::default()); + let mut context = commands.spawn(( + RapierContextColliders::default(), + RapierContextJoints::default(), + RapierContextSimulation::default(), + RapierRigidBodySet::default(), + )); // DOCUSAURUS: MultipleContexts_new stop context.insert(ContextId(i)); if i == 0 { @@ -81,7 +86,7 @@ fn change_context( } pub fn setup_physics( - context: Query<(Entity, &ContextId), With>, + context: Query<(Entity, &ContextId), With>, mut commands: Commands, ) { for (context_entity, id) in context.iter() { diff --git a/docs-examples/2d/bevy/examples/scene_queries2.rs b/docs-examples/2d/bevy/examples/scene_queries2.rs index 90edc4c..d32dbfc 100644 --- a/docs-examples/2d/bevy/examples/scene_queries2.rs +++ b/docs-examples/2d/bevy/examples/scene_queries2.rs @@ -46,7 +46,10 @@ fn setup_physics(mut commands: Commands) { // DOCUSAURUS: Raycast start /* Cast a ray inside of a system. */ -fn cast_ray(rapier_context: ReadDefaultRapierContext) { +fn cast_ray(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let ray_pos = Vec2::new(1.0, 2.0); let ray_dir = Vec2::new(0.0, 1.0); let max_toi = 4.0; @@ -95,7 +98,10 @@ fn cast_ray(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: Shapecast start /* Cast a shape inside of a system. */ -fn cast_shape(rapier_context: ReadDefaultRapierContext) { +fn cast_shape(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let shape = Collider::cuboid(1.0, 2.0); let shape_pos = Vec2::new(1.0, 2.0); let shape_rot = 0.8; @@ -123,7 +129,10 @@ fn cast_shape(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: PointProjection start /* Project a point inside of a system. */ -fn project_point(rapier_context: ReadDefaultRapierContext) { +fn project_point(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let point = Vec2::new(1.0, 2.0); let solid = true; let filter = QueryFilter::default(); @@ -151,7 +160,10 @@ fn project_point(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: IntersectionTest start /* Test intersections inside of a system. */ -fn test_intersections(rapier_context: ReadDefaultRapierContext) { +fn test_intersections(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let shape = Collider::cuboid(1.0, 2.0); let shape_pos = Vec2::new(0.0, 1.0); let shape_rot = 0.8; @@ -176,10 +188,13 @@ fn test_intersections(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: QueryFilter start /* Cast a ray inside of a system. */ fn cast_ray_filtered( - rapier_context: ReadDefaultRapierContext, + rapier_context: ReadRapierContext, player_query: Query>, custom_data_query: Query<&CustomData>, ) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let player_handle = player_query.single(); let ray_pos = Vec2::new(1.0, 2.0); let ray_dir = Vec2::new(0.0, 1.0); diff --git a/docs-examples/3d/bevy/Cargo.toml b/docs-examples/3d/bevy/Cargo.toml index 2776212..86e1db7 100644 --- a/docs-examples/3d/bevy/Cargo.toml +++ b/docs-examples/3d/bevy/Cargo.toml @@ -7,4 +7,4 @@ edition = "2021" [dependencies] bevy = "0.15" -bevy_rapier3d = "0.28" +bevy_rapier3d = "0.29" diff --git a/docs-examples/3d/bevy/examples/scene_queries3.rs b/docs-examples/3d/bevy/examples/scene_queries3.rs index 22be3e8..5f37a6b 100644 --- a/docs-examples/3d/bevy/examples/scene_queries3.rs +++ b/docs-examples/3d/bevy/examples/scene_queries3.rs @@ -40,7 +40,10 @@ fn setup_physics(mut commands: Commands) { // DOCUSAURUS: Raycast start /* Cast a ray inside of a system. */ -fn cast_ray(rapier_context: ReadDefaultRapierContext) { +fn cast_ray(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let ray_pos = Vec3::new(1.0, 2.0, 3.0); let ray_dir = Vec3::new(0.0, 1.0, 0.0); let max_toi = 4.0; @@ -89,7 +92,10 @@ fn cast_ray(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: Shapecast start /* Cast a shape inside of a system. */ -fn cast_shape(rapier_context: ReadDefaultRapierContext) { +fn cast_shape(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let shape = Collider::cuboid(1.0, 2.0, 3.0); let shape_pos = Vec3::new(1.0, 2.0, 3.0); let shape_rot = Quat::from_rotation_z(0.8); @@ -117,7 +123,10 @@ fn cast_shape(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: PointProjection start /* Project a point inside of a system. */ -fn project_point(rapier_context: ReadDefaultRapierContext) { +fn project_point(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let point = Vec3::new(1.0, 2.0, 3.0); let solid = true; let filter = QueryFilter::default(); @@ -145,7 +154,10 @@ fn project_point(rapier_context: ReadDefaultRapierContext) { // DOCUSAURUS: IntersectionTest start /* Test intersections inside of a system. */ -fn test_intersections(rapier_context: ReadDefaultRapierContext) { +fn test_intersections(rapier_context: ReadRapierContext) { + // Get the rapier context + let rapier_context = rapier_context.single(); + let shape = Collider::cuboid(1.0, 2.0, 3.0); let shape_pos = Vec3::new(0.0, 1.0, 2.0); let shape_rot = Quat::from_rotation_z(0.8); diff --git a/docs-examples/Cargo.lock b/docs-examples/Cargo.lock index 905e2b1..df804c6 100644 --- a/docs-examples/Cargo.lock +++ b/docs-examples/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "accesskit" @@ -888,28 +888,28 @@ checksum = "aa65df6a190b7dfc84d79f09cf02d47ae046fa86a613e202c31559e06d8d3710" [[package]] name = "bevy_rapier2d" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d396580d5437b6c6d03b1052ab934d43b6b3bea9bbe738560471bda2eb20717" +checksum = "9e5a44a053db18df1058d8c4d582962e66e982dc5c5c86e049d2fe5e2a332110" dependencies = [ "bevy", "bitflags 2.8.0", "log", "nalgebra", - "rapier2d 0.22.0", + "rapier2d", ] [[package]] name = "bevy_rapier3d" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fff77c1e3140f8fa9d08632841f42cbef06e4ad98ba61d65a6297369bad763" +checksum = "85f3856331b3f75e900db0fd47c34d7e63dc7f736f455e9d0e6d775a24099c37" dependencies = [ "bevy", "bitflags 2.8.0", "log", "nalgebra", - "rapier3d 0.22.0", + "rapier3d", ] [[package]] @@ -3292,31 +3292,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "parry2d" -version = "0.17.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02da9fbab5b42b6f5cc5550bfc14bfe4564f36d40beef3fa43752ed53fd3c6f1" -dependencies = [ - "approx", - "arrayvec", - "bitflags 2.8.0", - "downcast-rs", - "either", - "ena", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float", - "rustc-hash 2.1.0", - "simba", - "slab", - "smallvec", - "spade", - "thiserror", -] - [[package]] name = "parry2d" version = "0.18.0" @@ -3343,32 +3318,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "parry3d" -version = "0.17.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5d6c81f7d291d5ba572951242779a672f73ed605fe5520045c0bccdb381e913" -dependencies = [ - "approx", - "arrayvec", - "bitflags 2.8.0", - "downcast-rs", - "either", - "ena", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float", - "rstar", - "rustc-hash 2.1.0", - "simba", - "slab", - "smallvec", - "spade", - "thiserror", -] - [[package]] name = "parry3d" version = "0.18.0" @@ -3629,29 +3578,6 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" -[[package]] -name = "rapier2d" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643116992c25c96a07e1aae7d59fba207f01979dc9a107c42bcd4c4b83ef78b2" -dependencies = [ - "approx", - "arrayvec", - "bit-vec 0.7.0", - "bitflags 2.8.0", - "crossbeam", - "downcast-rs", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float", - "parry2d 0.17.5", - "rustc-hash 2.1.0", - "simba", - "thiserror", -] - [[package]] name = "rapier2d" version = "0.23.0" @@ -3669,7 +3595,7 @@ dependencies = [ "num-derive", "num-traits", "ordered-float", - "parry2d 0.18.0", + "parry2d", "profiling", "rustc-hash 2.1.0", "serde", @@ -3677,29 +3603,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "rapier3d" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87360935d1a54802efe0ddf908489436bb49c84865c36c930131843c7b1dc97d" -dependencies = [ - "approx", - "arrayvec", - "bit-vec 0.7.0", - "bitflags 2.8.0", - "crossbeam", - "downcast-rs", - "log", - "nalgebra", - "num-derive", - "num-traits", - "ordered-float", - "parry3d 0.17.5", - "rustc-hash 2.1.0", - "simba", - "thiserror", -] - [[package]] name = "rapier3d" version = "0.23.0" @@ -3717,7 +3620,7 @@ dependencies = [ "num-derive", "num-traits", "ordered-float", - "parry3d 0.18.0", + "parry3d", "profiling", "rustc-hash 2.1.0", "simba", @@ -3747,7 +3650,7 @@ dependencies = [ "bincode", "crossbeam", "nalgebra", - "rapier2d 0.23.0", + "rapier2d", "serde", ] @@ -3757,7 +3660,7 @@ version = "0.1.0" dependencies = [ "glam 0.27.0", "nalgebra", - "rapier3d 0.23.0", + "rapier3d", ] [[package]]