bevy_rapier
bevy_rapier copied to clipboard
ShapeCastHit has no details on ShapeCastStatus::Converged
Problem
I have panics in a game, because RapierContext::cast_shape
returns an object
ShapeCastHit {
time_of_impact: 2.4042375,
details: None,
status: Converged,
}
According to the docs of ShapeCastHit.details
, details
should be None
if PenetratingOrWithinTargetDist
and !compute_impact_geometry_on_penetration
, so I expected details
to be Some
for an object with status Converged
.
Solution attempt
The condition in
https://github.com/dimforge/bevy_rapier/blob/3455d5fbc1552116c0faa4bcf5657329e910c2c2/src/geometry/mod.rs#L110-L111
seems to be the issue.
details_always_computed
was given compute_impact_geometry_on_penetration
,
so it is not possible to get the details at all if PenetratingOrWithinTargetDist
,
and compute_impact_geometry_on_penetration
does only influence the behavior if status != PenetratingOrWithinTargetDist
.
To have the documented behavior, I think this condition should be
let details = if details_always_computed
|| hit.status != ShapeCastStatus::PenetratingOrWithinTargetDist