simulate
simulate copied to clipboard
Meshes for non-convex polygons
Collider-meshes for non-convex polygons currently require re-building a polygon out of invisible components or an advanced integration of a V-HACD algorithm for re-constructing a non-convex mesh as a convex set of meshes.
Some resources for solving this:
Code snippet that would work if trimesh has an installed v-hacd binary:
extract_mesh = land.mesh.extract_surface().triangulate()
faces_as_array = extract_mesh.faces.reshape((extract_mesh.n_faces, 4))[:, 1:]
tmesh = trimesh.Trimesh(land.mesh.points, faces_as_array)
meshes = trimesh.interfaces.vhacd.convex_decomposition(tmesh)
(reliant on converting meshes from pyvista)
Other:
- Habitat builds a old VHACD from source as a dependency
- a unity VHACD
- the most popular v-hacd repo (one C file to use it)