Open hakolao opened 2 months ago
The shape is correct with
FillMode::FloodFill {
detect_cavities: false,
detect_self_intersections: false,
}
.
But I can only use it for the initial state of the object (which can deform). For this particular object this isn't an issue though.
FillMode::SurfaceOnly
gives the same result as the reported example.
Kinda helps if i simplify the contours (to be less lines).
Thank you for providing this test case. I think the right move here is to not use VHACD in 2D (it was originally designed for 3D anyway), and switch to triangulation (currently implemented as ear-clipping in parry) + Hertel-Mehlhorn.
Both features already exist (TriMesh::from_polygon
and transformation::hertel_mehlhorn
) but they have limitations (like no support for holes, and an API that’s not just one function call); this will be improved in the near term.
Convex decomposition with params produces bad shapes.
I would like to use triangle colliders, because they provide better shapes (for dynamic bodies), but they break completely with
ccd
enabled, which is necessary to prevent objects going within terrain. Therefore, I use convex decomposition instead. However, that sometimes produces really bad shapes.I haven't found a combination of parameters which would fix this.
Contour input:![image](https://github.com/dimforge/parry/assets/12234005/e4f89647-2423-4060-b4c4-a93cee0be471)
Resulting collider:![image](https://github.com/dimforge/parry/assets/12234005/35fe9b18-896e-48ef-b32f-f2512ef206b1)
Test data: