diff --git a/CHANGELOG.md b/CHANGELOG.md index a0964762..8345b2cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and new features. Please have a look at the ### Fix - Fix rigidbodies never going to sleep when a scale was applied to their `Transform`. +- Fix losing information about hit details when converting from `ShapeCastHit` in parry to `ShapeCastHit` in bevy_rapier ## v0.26.0 (05 May 2024) diff --git a/src/geometry/mod.rs b/src/geometry/mod.rs index b1fcaa1d..f89198e3 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -107,17 +107,15 @@ impl ShapeCastHit { hit: rapier::parry::query::ShapeCastHit, details_always_computed: bool, ) -> Self { - let details = if !details_always_computed - && hit.status != ShapeCastStatus::PenetratingOrWithinTargetDist - { - Some(ShapeCastHitDetails { + let details = match (details_always_computed, hit.status) { + (_, ShapeCastStatus::Failed) => None, + (false, ShapeCastStatus::PenetratingOrWithinTargetDist) => None, + _ => Some(ShapeCastHitDetails { witness1: hit.witness1.into(), witness2: hit.witness2.into(), normal1: hit.normal1.into(), normal2: hit.normal2.into(), - }) - } else { - None + }), }; Self { time_of_impact: hit.time_of_impact,