dimforge / parry

2D and 3D collision-detection library for Rust.
https://parry.rs
Apache License 2.0
534 stars 93 forks source link

Inconsistent TOI between ball-vs-ball and support-map-vs-support-map #106

Open dubrowgn opened 1 year ago

dubrowgn commented 1 year ago

In v0.11.1, time-of-impact queries are returning inconsistent results for toi=0, depending on which shapes are involved.

If both shapes are balls, toi=0 results in status=converged (https://github.com/dimforge/parry/blob/v0.11.1/src/query/time_of_impact/time_of_impact_ball_ball.rs#L45)

     let status = if inside && center.coords.norm_squared() < rsum * rsum {
         TOIStatus::Penetrating
     } else {
         TOIStatus::Converged
     };

If one shape is a cuboid, and the other a ball, toi=0 results in status=penetrating (https://github.com/dimforge/parry/blob/v0.11.1/src/query/time_of_impact/time_of_impact_support_map_support_map.rs#L50):

    status: if toi.is_zero() {
        TOIStatus::Penetrating
    } else {
        TOIStatus::Converged
    },