Migrate to new Rapier.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2022-04-04 12:53:59 -05:00
parent 12c7759f66
commit aba63ebb19
2 changed files with 22 additions and 11 deletions

View File

@ -22,11 +22,15 @@ features = [
"serialize",
]
[dependencies.bevy_rapier2d]
git = "https://github.com/dimforge/bevy_rapier"
branch = "rapier-master"
features = ["simd-stable"]
[dependencies]
backtrace = "0.3"
bevy_input_actionmap = { git = "https://github.com/lightsoutgames/bevy_input_actionmap" }
bevy_openal = { git = "https://github.com/lightsoutgames/bevy_openal" }
bevy_rapier2d = { version = "0.12", features = ["serde-serialize", "simd-stable"] }
bevy_tts = { git = "https://github.com/lightsoutgames/bevy_tts", default-features = false, features = ["tolk"] }
coord_2d = "0.3"
derive_more = "0.99"
@ -40,3 +44,6 @@ rand = "0.8"
sentry = "0.25"
serde = "1"
shadowcast = "0.8"
[patch.crates-io]
rapier2d = { git = "https://github.com/dimforge/rapier", rev = "7efcff615e821" }

View File

@ -239,7 +239,7 @@ fn spawn_colliders<D: 'static + Clone + Default + Send + Sync>(
.remove::<SpawnColliders>()
.remove::<SpawnColliderPerTile>()
.insert_bundle(RigidBodyBundle {
body_type: RigidBodyTypeComponent(RigidBodyType::Static),
body_type: RigidBodyTypeComponent(RigidBodyType::Fixed),
..Default::default()
});
if **spawn_collider_per_tile {
@ -361,7 +361,7 @@ fn spawn_colliders<D: 'static + Clone + Default + Send + Sync>(
.spawn_bundle(ColliderBundle {
collider_type: ColliderType::Sensor.into(),
shape: shape.clone().into(),
flags: ActiveEvents::INTERSECTION_EVENTS.into(),
flags: ActiveEvents::COLLISION_EVENTS.into(),
position,
..Default::default()
})
@ -443,7 +443,7 @@ fn spawn_portal_colliders<D: 'static + Clone + Default + Send + Sync>(
collider_type: ColliderTypeComponent(ColliderType::Sensor),
shape: ColliderShape::cuboid(0.5, 0.5).into(),
position,
flags: ActiveEvents::INTERSECTION_EVENTS.into(),
flags: ActiveEvents::COLLISION_EVENTS.into(),
..Default::default()
})
.insert(ColliderPositionSync::Discrete);
@ -454,18 +454,22 @@ fn spawn_portal_colliders<D: 'static + Clone + Default + Send + Sync>(
}
fn area_description(
mut events: EventReader<IntersectionEvent>,
mut events: EventReader<CollisionEvent>,
areas: Query<(&Area, Option<&Name>)>,
players: Query<&Player>,
config: Res<MapConfig>,
mut log: Query<&mut Log>,
) {
for event in events.iter() {
if let Some((area, other)) =
target_and_other(event.collider1.entity(), event.collider2.entity(), &|v| {
areas.get(v).is_ok()
})
{
let (entity1, entity2, started) = match event {
CollisionEvent::Started(collider1, collider2) => {
(collider1.entity(), collider2.entity(), true)
}
CollisionEvent::Stopped(collider1, collider2, _) => {
(collider1.entity(), collider2.entity(), false)
}
};
if let Some((area, other)) = target_and_other(entity1, entity2, &|v| areas.get(v).is_ok()) {
if players.get(other).is_ok() {
if let Ok((aabb, area_name)) = areas.get(area) {
let name = if let Some(name) = area_name {
@ -477,7 +481,7 @@ fn area_description(
};
if let Some(name) = name {
if let Ok(mut log) = log.get_single_mut() {
if event.intersecting {
if started {
log.push(format!("Entering {name}."));
} else {
log.push(format!("Leaving {name}."));