There are three separate components included in this package. Click on the links below to see documentation for that specific script.
- Fracture - Break meshes into pieces during runtime.
- Prefracture - Used for pre-fracturing meshes in the editor. The generated fragments can either be saved directly in the scene or saved to disk if you would like to create a prefab.
- Slice - Runtime slicing of meshes
Before using the scripts, there are a few limitations and considerations to be aware of.
1. If you are importing a custom mesh, you must set "Read/Write Enabled" to true in the Import settings. Otherwise you will get an error.
Depicted above is the wireframe model of a stool. Notice how the crossbars intersect the legs of the stool. Intersecting geometry will cause the triangulation algorithm (which fills in the newly cut faces) to fail and will result in artifacts like you see below. The triangulation algorithm I implemented does not handle self-intersecting polygons. Detecting self-intersecting geometry is a non-trivial problem and is not something I plan on adding.
The fracturing process is a computationally intensive process. Simple models (several hundred vertices) can be fractured into dozens of pieces without much of a hitch. The performance of fracturing complex models consisting of several thousands vertices during runtime will likely be quite slow on older, less capable machines.
Here are some tips for optimizing performance
- Reduce number of fragments
- Disable or reduce the number of refracturing interations
- Prefracture models in the editor rather than fracturing during runtime
- Bring your model into a 3D modeling program like Blender and use the Decimation tool to simplify the mesh geometry