-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
QuickHull generates bad hull sometimes when multiple triangles share the same plane. #45946
Comments
Same issue occurs when I generate convex collision shape on this model. Attaching it for testing purposes. |
Can't help with the C++, just chiming in that I am having the same issue with autogenerated hulls. I am not 100% certain which mesh is causing those, as the collisions work just fine, but I do get the log messages (and they are quite spammy, I am suspecting it's either the roads or buildings in my project) |
Godot version:
3.2.3
3.2.4.rc2
OS/device including version:
Windows 10
Issue description:
QuickHull fails to merge edges sometimes and results in generating multiple of the same plane and wrong geometry. Errors printed to the log include things like:
core\math\quick_hull.cpp:402 - Condition "O == 0" is true. Continuing.
core\math\quick_hull.cpp:399 - Condition "!F" is true. Continuing.
core\math\quick_hull.cpp:428 - Condition "!F2" is true. Continuing.
Example:
Edit: Just tried in 3.2.4.rc2, and the result was slightly different, but still broken:
(Should just be an octagon)
Steps to reproduce:
Generate a convex collision from something like a cylinder or another object that has many triangles on the same face, preferably at some odd angle. Doesn't always reproduce.
Notes:
I've stepped through the QuickHull::build() function, and the problem seems to reside in the logic to merge faces and remove edges on a single plane. It makes some assumptions about the structure/order of vertices. If things overlap instead of being next to each other, the algorithm falls apart. When the errors happen, extra planes are left in the hull that shouldn't be there.
It might be better to just generate the the planes, ignoring edges and verts, then generate the edges and verts at the end based on plane intersections. It would also be nice if the edge generation was optional, because it's only necessary when displaying the hull, not when using it for collision purposes.
Minimal reproduction project:
test_quickull.zip
The text was updated successfully, but these errors were encountered: