diff --git a/Cargo.toml b/Cargo.toml index 04ef78a..956a26f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ features = [ [dependencies] backtrace = "0.3" bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap" } -bevy_rapier2d = { version = "0.14", features = ["enhanced-determinism", "serde-serialize"] } +bevy_rapier2d = { version = "0.15", features = ["serde-serialize"] } bevy_synthizer = { git = "https://labs.lightsout.games/projects/bevy_synthizer" } bevy_tts = { git = "https://github.com/lightsoutgames/bevy_tts", default-features = false, features = ["tolk"] } coord_2d = "0.3" diff --git a/src/exploration.rs b/src/exploration.rs index 3c8fc0d..16022b3 100644 --- a/src/exploration.rs +++ b/src/exploration.rs @@ -351,8 +351,7 @@ fn exploration_changed_announcement( exploring, 0., &shape, - InteractionGroups::all(), - Some(&|v| explorable.get(v).is_ok()), + QueryFilter::new().predicate(&|v| explorable.get(v).is_ok()), |entity| { commands.entity(entity).insert(ExplorationFocused); if visible || mappables.get(entity).is_ok() { diff --git a/src/map.rs b/src/map.rs index 82cc82f..a99a087 100644 --- a/src/map.rs +++ b/src/map.rs @@ -247,7 +247,7 @@ fn spawn_colliders( let id = commands .spawn() .insert(shape) - .insert(Sensor(true)) + .insert(Sensor) .insert(ActiveEvents::COLLISION_EVENTS) .insert(Transform::from_xyz( position.translation.x, @@ -317,17 +317,18 @@ fn spawn_portals( fn spawn_portal_colliders( mut commands: Commands, - map: Query<&SpawnColliders, With>>, + map: Query<(Entity, &SpawnColliders), With>>, portals: Query, Without)>, ) { - for spawn_colliders in map.iter() { + for (entity, spawn_colliders) in map.iter() { if **spawn_colliders { for portal_entity in portals.iter() { commands .entity(portal_entity) .insert(Collider::cuboid(0.5, 0.5)) - .insert(Sensor(true)); + .insert(Sensor); } + commands.entity(entity).remove::(); } } } diff --git a/src/pathfinding.rs b/src/pathfinding.rs index 934235e..c517d8e 100644 --- a/src/pathfinding.rs +++ b/src/pathfinding.rs @@ -8,7 +8,7 @@ use bevy::{ use bevy_rapier2d::{ na::{Isometry2, Vector2}, prelude::*, - rapier::prelude::{ColliderHandle, ColliderSet, QueryPipeline}, + rapier::prelude::{ColliderHandle, ColliderSet, QueryPipeline, RigidBodySet}, }; use futures_lite::future; @@ -66,6 +66,7 @@ fn find_path_for_shape( map: Map, query_pipeline: QueryPipeline, collider_set: ColliderSet, + rigid_body_set: RigidBodySet, shape: Collider, ) -> Option { let path = astar( @@ -78,11 +79,12 @@ fn find_path_for_shape( let shape_pos = Isometry2::new(Vector2::new(tile.0 as f32 + 0.5, tile.1 as f32 + 0.5), 0.); query_pipeline.intersections_with_shape( + &rigid_body_set, &collider_set, &shape_pos, &*shape.raw, - InteractionGroups::all(), - Some(&|v| v != initiator), + bevy_rapier2d::rapier::pipeline::QueryFilter::new() + .predicate(&|h, _c| h != initiator), |_handle| { should_push = false; false @@ -146,9 +148,9 @@ fn calculate_path( to_remove.push(handle.0); } } + let mut bodies = rapier_context.bodies.clone(); if !to_remove.is_empty() { let mut islands = rapier_context.islands.clone(); - let mut bodies = rapier_context.bodies.clone(); for handle in to_remove { collider_set.remove(handle, &mut islands, &mut bodies, false); } @@ -162,6 +164,7 @@ fn calculate_path( map_clone, query_pipeline, collider_set, + bodies, shape_clone, ) }); diff --git a/src/visibility.rs b/src/visibility.rs index 8900379..747afe3 100644 --- a/src/visibility.rs +++ b/src/visibility.rs @@ -89,8 +89,7 @@ impl Viewshed { shape_pos, 0., &shape, - InteractionGroups::all(), - Some(&|v| visible_query.get(v).is_ok()), + QueryFilter::new().predicate(&|v| visible_query.get(v).is_ok()), |entity| { let obstruction = obstructions_query.get(entity).is_ok(); if obstruction {