Skip to content
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: 2 additions & 2 deletions docs-examples/2d/bevy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.15"
bevy_rapier2d = "0.28"
bevy = "0.16"
bevy_rapier2d = "0.30"
17 changes: 9 additions & 8 deletions docs-examples/2d/bevy/examples/advanced_collision_detection2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ fn display_events(
// DOCUSAURUS: Events stop

// DOCUSAURUS: ContactGraph1 start
fn display_contact_info(rapier_context: ReadDefaultRapierContext, custom_info: Res<CustomInfo>) {
fn display_contact_info(rapier_context: ReadRapierContext, custom_info: Res<CustomInfo>) {
let rapier_context = rapier_context.single().unwrap();
let entity1 = custom_info.entity1; // A first entity with a collider attached.
let entity2 = custom_info.entity2; // A second entity with a collider attached.

Expand Down Expand Up @@ -119,14 +120,15 @@ 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<CustomInfo>,
) {
let rapier_context = rapier_context.single().unwrap();
let entity = custom_info.entity2; // An entity with a collider attached.

/* Iterate through all the contact pairs involving a specific collider. */
for contact_pair in rapier_context.contact_pairs_with(entity) {
let other_collider = if contact_pair.collider1() == entity {
let other_collider = if contact_pair.collider1() == Some(entity) {
contact_pair.collider2()
} else {
contact_pair.collider1()
Expand All @@ -139,10 +141,8 @@ fn display_contact_info_all_from_1_entity(
// DOCUSAURUS: ContactGraph2 stop

// DOCUSAURUS: IntersectionGraph1 start
fn display_intersection_info(
rapier_context: ReadDefaultRapierContext,
custom_info: Res<CustomInfo>,
) {
fn display_intersection_info(rapier_context: ReadRapierContext, custom_info: Res<CustomInfo>) {
let rapier_context = rapier_context.single().unwrap();
let entity1 = custom_info.entity1; // A first entity with a collider attached.
let entity2 = custom_info.entity2; // A second entity with a collider attached.

Expand All @@ -158,9 +158,10 @@ fn display_intersection_info(

// DOCUSAURUS: IntersectionGraph2 start
fn display_intersection_info_all_from_1_entity(
rapier_context: ReadDefaultRapierContext,
rapier_context: ReadRapierContext,
custom_info: Res<CustomInfo>,
) {
let rapier_context = rapier_context.single().unwrap();
let entity = custom_info.entity2; // An entity with a collider attached.

/* Iterate through all the intersection pairs involving a specific collider. */
Expand Down
6 changes: 3 additions & 3 deletions docs-examples/2d/bevy/examples/multiple_contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ 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(RapierContextSimulation::default());
// DOCUSAURUS: MultipleContexts_new stop
context.insert(ContextId(i));
if i == 0 {
Expand Down Expand Up @@ -70,7 +70,7 @@ fn change_context(
query_context: Query<Entity, With<DefaultRapierContext>>,
mut query_links: Query<(Entity, &mut RapierContextEntityLink)>,
) {
let default_context = query_context.single();
let default_context = query_context.single().unwrap();
for (e, mut link) in query_links.iter_mut() {
if link.0 == default_context {
continue;
Expand All @@ -81,7 +81,7 @@ fn change_context(
}

pub fn setup_physics(
context: Query<(Entity, &ContextId), With<RapierContext>>,
context: Query<(Entity, &ContextId), With<RapierContextSimulation>>,
mut commands: Commands,
) {
for (context_entity, id) in context.iter() {
Expand Down
17 changes: 11 additions & 6 deletions docs-examples/2d/bevy/examples/scene_queries2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
let ray_pos = Vec2::new(1.0, 2.0);
let ray_dir = Vec2::new(0.0, 1.0);
let max_toi = 4.0;
Expand Down Expand Up @@ -95,7 +96,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
let shape = Collider::cuboid(1.0, 2.0);
let shape_pos = Vec2::new(1.0, 2.0);
let shape_rot = 0.8;
Expand Down Expand Up @@ -123,7 +125,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
let point = Vec2::new(1.0, 2.0);
let solid = true;
let filter = QueryFilter::default();
Expand Down Expand Up @@ -151,7 +154,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
let shape = Collider::cuboid(1.0, 2.0);
let shape_pos = Vec2::new(0.0, 1.0);
let shape_rot = 0.8;
Expand All @@ -176,11 +180,12 @@ 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<Entity, With<Player>>,
custom_data_query: Query<&CustomData>,
) {
let player_handle = player_query.single();
let rapier_context = rapier_context.single().unwrap();
let player_handle = player_query.single().unwrap();
let ray_pos = Vec2::new(1.0, 2.0);
let ray_dir = Vec2::new(0.0, 1.0);
let max_toi = 4.0;
Expand Down
2 changes: 1 addition & 1 deletion docs-examples/2d/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@dimforge/rapier2d": "0.14.0"
"@dimforge/rapier2d": "0.17.3"
}
}
1 change: 1 addition & 0 deletions docs-examples/2d/javascript/static-web-server.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[general]
cache-control-headers = false
compression = false
port = 8080
4 changes: 2 additions & 2 deletions docs-examples/2d/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rapier2d = { version = "0.23.0", features = ["serde-serialize"] }
rapier2d = { version = "0.26.1", features = ["serde-serialize"] }
nalgebra = { version = "0.33" }
# Used for events handling
crossbeam = "0.8.4"
# Used For serialization
bincode = "1.3.3"
bincode = { version = "2.0.1", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
9 changes: 7 additions & 2 deletions docs-examples/2d/rust/examples/rs_serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ struct PhysicsState {
fn main() {
let physics_state = setup_physics_scene();
// Serialize everything.
let serialized = bincode::serialize(&physics_state).unwrap();
let serialized =
bincode::serde::encode_to_vec(&physics_state, bincode::config::standard()).unwrap();
// Deserialize everything.
let deserialized = bincode::deserialize::<PhysicsState>(&serialized).unwrap();
let deserialized = bincode::serde::decode_from_slice::<PhysicsState, _>(
&serialized,
bincode::config::standard(),
)
.unwrap();
// The simulation can continue using the deserialized state.
}
// DOCUSAURUS: Serialization stop
Expand Down
4 changes: 2 additions & 2 deletions docs-examples/3d/bevy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.15"
bevy_rapier3d = "0.28"
bevy = "0.16"
bevy_rapier3d = "0.30"
12 changes: 8 additions & 4 deletions docs-examples/3d/bevy/examples/scene_queries3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
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;
Expand Down Expand Up @@ -89,7 +90,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
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);
Expand Down Expand Up @@ -117,7 +119,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
let point = Vec3::new(1.0, 2.0, 3.0);
let solid = true;
let filter = QueryFilter::default();
Expand Down Expand Up @@ -145,7 +148,8 @@ 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) {
let rapier_context = rapier_context.single().unwrap();
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);
Expand Down
32 changes: 5 additions & 27 deletions docs-examples/3d/javascript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs-examples/3d/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@dimforge/rapier3d": "0.14.0"
"@dimforge/rapier3d": "0.17.3"
}
}
1 change: 1 addition & 0 deletions docs-examples/3d/javascript/static-web-server.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[general]
cache-control-headers = false
compression = false
port = 8080
6 changes: 3 additions & 3 deletions docs-examples/3d/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rapier3d = { version = "0.23", features = ["enhanced-determinism"] }
nalgebra = { version = "0.33", features = ["convert-glam027"] }
rapier3d = { version = "0.26.1", features = ["enhanced-determinism"] }
nalgebra = { version = "0.33", features = ["convert-glam029"] }
# Used to demonstrate compatibility.
glam = "0.27.0"
glam = "0.29.3"
Loading