Description
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
Activity