-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
time_of_impact_support_map_support_map
returns None
when it shouldn't with very specific inputs
#180
Comments
Sounds like this could be the same root cause as #107. |
It seems like the issue here is essentially that GJK (or in this case the ray cast onto the Minkowski difference) uses a tolerance value that is too strict for checking whether the origin is contained within the CSO for the simplex of the maximum dimension. In other words, for one of the termination criteria, the algorithm is too strict for what it considers to be a valid result, which causes misses even in cases where there should be a clear hit. The specific line in question is this Lines 353 to 359 in e19f9f0
Making the tolerance larger by multiplying it by 10 seems to fully fix the issue for me in my demo. I am unsure whether this is a "correct" solution however, and the scale of the shapes in the scene could potentially affect results. |
Thanks @Jondolf for sharing your insights!
Now the reproduction is probably at fault there as the shape is not centered at the origin, but 600 distance from the origin doesn't strike me as atrociously far. I can see a few ways to go:
I'm curious to know which edge case a too big epsilon would return an incorrect result. |
I'm trying to get the TOI between a moving square (
Cuboid
) and a stationary line (Segment
), so I'm usingtime_of_impact_support_map_support_map
. This works perfectly fine most of the time, but I realised that I keep getting someNone
s, when there definetely should be a collision.These
None
s always appear for certain inputs (the square's initial position/velocity). For example, if the square starts at (15.689465, 54.00709) with velocity (0.0081385, -0.999966), it returnsNone
, but if you add or subtract .000001 from any of those values, it returnsSome
.I have created an MRE:
This obviously also happens with
time_of_impact
, and also with aPolyline
instead of a singleSegment
.I narrowed down the point that the wrong one diverges from the correct ones to two lines in
minkowski_ray_cast
insrc/query/gjk/gjk.rs
:parry/src/query/gjk/gjk.rs
Lines 350 to 351 in e57762f
In the correct versions, at the end of the two lines,
simplex.dimension() == 1
, however, in the wrong version, it is 2, causing the function to returnNone
early.I, however, have no idea how simplexes work; so I couldn't go any further. Hopefully someone else can figure this out.
This issue also exists in ncollide.
The text was updated successfully, but these errors were encountered: