dimforge / dimforge/bevy_rapier
ShapeCastHit has no details on ShapeCastStatus::Converged
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 282
- PR merge metrics
- No merged PRs in 30d
Description
# Problem
I have panics in a game, because `RapierContext::cast_shape` returns an object
```rust
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
```rust
let details = if details_always_computed
|| hit.status != ShapeCastStatus::PenetratingOrWithinTargetDist
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.