You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Convex decomposition for arbitrary geometry (automatic collision hulls) #187
The analytic primitives expose a matching collisionShape, but arbitrary imported or generated meshes have no automatic hull. Add convex decomposition so any Geometry (or TriMeshShape) can produce an accurate CompoundShape of convex pieces.
Suggested approach. Expose parry's V-HACD through the flutter_scene_rapier FFI, which avoids porting the algorithm to Dart, with a Dart API such as decomposeToCompound(geometry, {params}). Because V-HACD is too slow to run per spawn, also support baking hulls ahead of time (decompose at asset-build time via the build hook and ship the result), with runtime decomposition as the convenience path.
Dynamic bodies need convex pieces, since a raw triangle-mesh collider is static-only, which is exactly what decomposition provides.
Context. The convention so far is that each analytic primitive returns its matching collisionShape (box, sphere, capsule, cylinder, convex hull, plus compound shapes for the torus and ring). Arbitrary geometry is the remaining gap.
V-HACD through Rapier is a good backend, but the API should expose deterministic parameters, cancellation/progress, and limits on hull count/vertices because runtime decomposition can be expensive on mobile. Build-time baking should serialize a versioned hull asset keyed by source mesh plus parameters so stale results are invalidated. Tests should compare runtime and baked compounds, preserve transforms/winding, reject degenerate meshes, and verify FFI allocations are released on failure.
Activity
hiSandog commentedon Jul 11, 2026
V-HACD through Rapier is a good backend, but the API should expose deterministic parameters, cancellation/progress, and limits on hull count/vertices because runtime decomposition can be expensive on mobile. Build-time baking should serialize a versioned hull asset keyed by source mesh plus parameters so stale results are invalidated. Tests should compare runtime and baked compounds, preserve transforms/winding, reject degenerate meshes, and verify FFI allocations are released on failure.