Upgrade Rapier.
This commit is contained in:
parent
65067412af
commit
bff40340a8
|
@ -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"
|
||||
|
|
|
@ -351,8 +351,7 @@ fn exploration_changed_announcement<D: 'static + Clone + Default + Send + Sync>(
|
|||
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() {
|
||||
|
|
|
@ -247,7 +247,7 @@ fn spawn_colliders<D: 'static + Clone + Default + Send + Sync>(
|
|||
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<D: 'static + Clone + Default + Send + Sync>(
|
|||
|
||||
fn spawn_portal_colliders<D: 'static + Clone + Default + Send + Sync>(
|
||||
mut commands: Commands,
|
||||
map: Query<&SpawnColliders, With<Map<D>>>,
|
||||
map: Query<(Entity, &SpawnColliders), With<Map<D>>>,
|
||||
portals: Query<Entity, (With<Portal>, Without<Collider>)>,
|
||||
) {
|
||||
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::<SpawnColliders>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<D: 'static + Clone + Default + Send + Sync>(
|
|||
map: Map<D>,
|
||||
query_pipeline: QueryPipeline,
|
||||
collider_set: ColliderSet,
|
||||
rigid_body_set: RigidBodySet,
|
||||
shape: Collider,
|
||||
) -> Option<Path> {
|
||||
let path = astar(
|
||||
|
@ -78,11 +79,12 @@ fn find_path_for_shape<D: 'static + Clone + Default + Send + Sync>(
|
|||
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<D: 'static + Clone + Default + Send + Sync>(
|
|||
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<D: 'static + Clone + Default + Send + Sync>(
|
|||
map_clone,
|
||||
query_pipeline,
|
||||
collider_set,
|
||||
bodies,
|
||||
shape_clone,
|
||||
)
|
||||
});
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user