Dynamic Mesh Splitting
Dynamic Mesh Splitting is a Unity package I created for splitting 3D meshes at runtime. The algorithm uses an infinite plane in 3D space to divide a mesh into two new meshes. It puts a heavy focus on Data Oriented Design and performance.
Capabilities & Limitations
The algorithm is able to split concave meshes that don't have holes which are created by the shape of their geomerty (genus 0). This means it won't be able to split torus shapes correctly across.
- Splitting of skinned meshes is supported.
- Meshes with submeshes are also supported.
- Splitting can be done asynchronous to avoild lag spikes.
- Custom materials and uv bounds can be applied to the caps created by splitting.
- Island detection is not implemented, meaning that all parts of a mesh that lie on the same side of the plane are part of the same split mesh. Even if they are not attached to eachother anymore.
I used an earclipping inplementation to triangulate the slice cap. Faster algotithms exist, but earclipping was more straightforward to implement.
The Unity package and original project are licensed under MIT, available on GitHub