Comments (4)
In Rapier, this is typically caused by CCD, because that uses nonlinear_time_of_impact
, which in turn uses nonlinear_time_of_impact_support_map_support_map
for most shapes.
I don't have time to look into this too deeply right now, but for others wanting to debug this, here are some of my findings just based on looking at the codebase.
The problem
The actual issue here is interesting. The non-linear time of impact query calls closest_points
with a max distance using the maximal real value, i.e. Real::MAX
(or Bounded::max_value()
):
Because the max distance is essentially the largest it can be, the result is expected to never be ClosestPoints::Disjoint
(i.e. non-intersecting and above the max distance). This is why the Disjoint
variant is specified as unreachable, but somehow it is reached regardless, which causes the panic.
This indicates that the closest_points
query seems to be the actual culprit for the crash, as it returns Disjoint
in a case where it should never happen.
Potential reasons for returning Disjoint
One option is that the distance between two objects is somehow Real::INFINITY
for whatever reason. I think this would qualify as larger than Real::MAX
, which could make closest_points
return Disjoint
.
If the closest_points
method uses GJK for the given shape pair (it depends on the shapes), a very likely reason it can return Disjoint
could be that GJK returns NoIntersection
, because closest_points_support_map_support_map
returns Disjoint
in that case:
This either happens if (1) at any moment the minimum bound computed by GJK is larger than the maximum distance (it'd have to be Real::INFINITY
in this case), or if (2) GJK runs out of iterations before converging on a solution.
Finally, if the specific shape pair doesn't use GJK for closest_points
, it could be that its special implementation happens to have a bug that causes it to incorrectly return Disjoint
.
Debugging
If someone wants to debug this, I would recommend finding what exactly returns Disjoint
by adding logs in the appropriate places, like the "unreachable" match branch and the closest_points
implementations. If it's caused by GJK returning NoIntersection
, adding logs there to see what the shapes and isometries are could be useful.
from parry.
Yep, it was changed temporarily to log an error instead of panicking in #192 until a proper fix is found
from parry.
I got this too (in rapier3d after despawning a bunch of things)
from parry.
Note that for me while I previously got the same panic, after updating to parry3d 0.15.1
it is now a logged error instead of a panic:
ERROR log: Closest points not found despite setting the max distance to infinity.
See this comment for my reproduction using bevy_rapier
from parry.
Related Issues (20)
- Documentation and source code inconsistencies
- QBVH `rebalance` still panics at 'attempt to add with overflow' HOT 6
- Export `size_32/size_64` features from `rkyv` HOT 1
- Add method to scale an AABB wrt its center HOT 1
- Contact query giving incorrect result for Frustums HOT 5
- Pathtracer ?
- Large convex hulls produce incorrect contact manifolds HOT 2
- Ray casts which touch a TriMesh edge report intersection with a backface HOT 1
- Point in polygon 2D test failure
- Doc info for VHACD best parameters
- `Aabb::vertices()` returns the vertices in incorrect order
- Implement Debug for TriMesh HOT 1
- Incorrect docs in TriMeshFlags
- `time_of_impact_support_map_support_map` returns `None` when it shouldn't with very specific inputs HOT 2
- Convex decomposition in 2d produces bad shapes HOT 3
- Matrix index out of bounds when using convex decomposition 2d
- Shape casting returns incorrect normals
- project_local_point fails to find the correct projection when the point lies on a triangle edge
- panicked at epa3.rs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parry.