Creating a fractured object is easy. Here are some quick steps for a normal start:
If the parameter Chunk Interconnection is checked (it is by default) then you may want to add a support plane to attach the object to the world. Normally you will create a plane representing the floor but you can also rotate the plane to attach the object to walls or ceilings. The chunks that are on the -Y side of the plane will be marked in blue, they are the ones that will be fixed to the world and are indestructible, we call them support chunks. All other chunks can be destroyed but will remain attached to the object through the support chunks unless enough force is applied to them.
Support chunks are VERY important because they are the ones that enable intelligent collapsing. If you have a pillar and you destroy it shooting in the middle, you want all the chunks from the middle to the top to collapse too. In this case you create a plane representing the floor and make it intersect the chunks at the bottom to mark them as support.
There are some cases where you don't want an object to be attached to the ground, but rather to the ceiling in the case of a lamp for example. In this case you need to rotate the plane to turn it upside down and move it to the ceiling to mark the top chunks as support. You can create multiple planes with any orientation and size for complex setups.
Now you probably want to edit how the object will be fractured and add visual effects to it. All this is done using the Events section of the panel.
The Chunk Detach From Object Due To Physic Collision section enables the object to be fractured when a rigidbody collides with it. You can set the minimum mass and velocity required to detach a chunk from the structure. The Interconnection Strength parameter in the main section plays an important role here, as with lower values you not only will detach the chunk that was hit, but also its neigbours.
You can also select the sound clip that is played when a chunk was detached and select a prefab list where one random prefab will be chosen and instanced on the collision point. The prefab normally will be a particle system containing an explosion or a dust cloud. Check our sample scenes for use cases.
The Free (Detached) Chunks section handles the collision events of chunks that have already been detached from the structure. You can edit the lifetime of chunks to limit the amount of rigidbodies active at the same time and save CPU power.
Here you can also edit the minimum amount of mass and velocity a chunk needs in order to create a collision event. Like on the previous section, you can edit which sound is played and the prefabs to be instanced with one additional feature: Instead of specifying a single sound clip you can edit a list of clips where a sound clip will be randomly selected and played on each collision. This way we have more natural and random sounds.
The When Explode() Is Called Through Scripting (Explosions) section handles the scripting-triggered event when FracturedObject.Explode() is called (see scripting section for more details).
You can edit the sound that is played when the explosion occurs and also specify a list of prefabs that will be instanced randomly all over the object. This can be used both for explosion particles and dust particles.
The When Impact() Is Called Through Scripting (f.e. missiles) section handles the scripting-triggered event when FracturedChunk.Impact() is called (see scripting section for more details).
You can edit the sound that is played on impact and also the prefab that will be instanced on the collision point (most likely an explosion or a dust particle system).
We recommend to take a look at the samples for actual use cases.
There are many more parameters to play with, here is the complete help reference:
The main fracturing parameters.
The object whose mesh will be used as input for the fracturing. It won't be deleted, just used as input typeof(GameObject), true);
Detect isolated meshes when sptting and make them separated chunks (f.e. if you spt a U shape horizontally, it will give 3 objects with island generation (the bottom and the two tips separated), instead of 2 (the bottom on one hand and the two tips as the same object on the other).
If Chunk Interconnection is checked and no support planes or support chunks have been defined, an object would collapse on start. Check this if you want the object to stay static until first contact.
Minimum area between 2 connected chunks to consider them connected. Setting it to zero won't consider all chunks connected, only those that share at least a common face area no matter how small. You can change this value without the need to recompute the chunks.
When a chunk attached to the object is hit and detached, this controls how many connected chunks will detach too. 0.0 will make the whole object collapse, 1.0 won't detach any connected chunks. You can change this value without the need to recompute the chunks.
Controls the maximum horizontal distance a chunk must be from a support chunk to stay attached to the object. If its distance is greater than this value, it will fall. For example in the arcs and columns sample scene, if you destroy columns that are next to each other, the top part will collapse as well if it is too distant horizontally to the closest column, which contain the support chunks.
If it is enabled, support chunks can not be destroyed/removed from the object.
When feeding a source object, and Island Generation is active, it may detect multiple closed meshes inside and some of them may be connected to others. This controls how far a face from one island can be from another island to consider the two islands connected.
The total mass of the object. Each chunk mass will be computed depending on its size and this value. You can change this value without the need to recompute the chunks.
The physic material assigned to each chunk.
Chunks with a volume less than this value will have a box colder instead of a mesh colder to speed up colsions.
Change this value from 0 only if you experience weird triangles added to the mesh or unexpected crashes! This usually happens on meshes with very thin faces due to floating point errors. A good range is usually 0.001 to 0.02, larger values will introduce small visible variations on some spts. If there's only 2 or 3 problematic faces, then an alternative would be using another random seed.
Check this if for some reason the interior faces have reversed ghting.
These parameters control the way the slicing will be performed and the interior material.
The fracture algorithm. Voronoi generates cellular, more natural looking chunks while BSP slices objects progressively using planes until the target number of chunks is reached. BSP is faster to compute and provides different control.
Voronoi is currently under heavy optimization to work way faster with a high number of cells.
Will compute fracturing faster when using large meshes or with huge empty volume.
Used to speed up Voronoi computation. On some cases it can introduce intersecting chunks, disable it when this occurs.
Will use multithreading for some Voronoi computation steps. It isn't fully tested/optimized but it should work. Only disable if you experience any problems."));
Voronoi will generate X*Y*Z cells. This is number of cells to generate in the X dimension.
Voronoi will generate X*Y*Z cells. This is number of cells to generate in the Y dimension.
Voronoi will generate X*Y*Z cells. This is number of cells to generate in the Z dimension.
Greater values will increase difference in size and positioning of cells in the X dimension.
Greater values will increase difference in size and positioning of cells in the Y dimension.
Greater values will increase difference in size and positioning of cells in the Z dimension.
The number of chunks to fracture the mesh into.
Controls if the slicing will be performed in local object space or in world space. Note that the original object orientation is considered, not the fractured object.
If set, slices will always be performed to minimize the chunk size in all its axes, otherwise they will be performed randomly with the probabilities given.
Probability (0-1) that a slice is performed in X.
Probability (0-1) that a slice is performed in Y.
Probability (0-1) that a slice is performed in Z.
0.0 will give chunks more equally sized. Increasing values will give chunks varying more in size.
Angular variation for the slices in the X plane.
Angular variation for the slices in the Y plane.
Angular variation for the slices in the Z plane.
Material applied to the interior faces of the chunks.
U Tiling of the interior faces mapping.
V Tiling of the interior faces mapping.
These parameters control the behavior of the object on some events.
The minimum mass an object needs to have to detach a chunk from this object on impact.
The minimum velocity an object needs to impact with to detach a chunk from this object.
If a chunk is detached due to an impact, it will have this value applied to it.
Adds an upwards explosion effect to the chunks that have exit force. A value of 0.0 won't add any effect, while 2.0 means it will apply the force from a distance of 2 below the chunk."));
Will play this sound on the collision point when a chunk is detached due to an impact.
A list of prefabs. When a chunk is detached due to an impact, a random prefab will be picked from this list and instanced on the collision point. Use this for particles/explosions.
The method name that will be called on an impact-triggered detach chunk event (see next parameter and scripting reference).
The GameObject whose method will be called. See the scripting reference.
The minimum lifetime of a free chunk. When the life of a chunk expires it will be deleted.
The maximum lifetime of a free chunk. When the life of a chunk expires it will be deleted.
If a free chunk is outside the visible screen for more than this seconds, it will be deleted.
The minimum mass a free chunk need to impact with in order to trigger a collision event.
The minimum velocity a free chunk need to impact with in order to trigger a collision event.
The maximum collision sounds that will be played at the same time.
A list of sounds. On a free chunk collision a random sound will be picked from this list and played on the collision point.
The maximum number of collision prefabs present at the same time.
A list of prefabs. On a free chunk collision a random prefab will be picked from this list and instanced on the collision point. Use this for particles/explosions.
The method name that will be called on a free chunk collision (see next parameter and scripting reference).
The GameObject whose method will be called. See scripting reference.
The sound that will be played when Explode() is called on this object.
The number of prefabs to instance on random positions of the object.
A list of prefabs. When Explode() is called a random number of them will be instanced on random positions of the object. Use this for particles/explosions.
The sound that will be played when Impact() is called on this object.
A list of prefabs. When Impact() is called a random prefab will be instanced on the impact point. Use this for particles/explosions.
The method name that will be called when a chunk is detached no matter the reason (see next parameter and scripting reference).
The GameObject whose method will be called. See scripting reference.
Support planes control which chunks are tagged as support. All chunks that are one the negative side (pointed by the plane -Y) and inside its limits will be marked as support.
Chunks that act as support can't be destroyed and will hold the object together. A chunk needs to be connected to a support chunk (directly or through other chunks) or otherwise it will fall. This prevents chunks from staying static in the air and enables realistic collapsing behavior.
Adds a new support plane to this object.
The name that will be shown on the scene view.
Plane position with respect to the fractured object.
Plane rotation with respect to the fractured object. Use this to change the attachment to for example, the ceiling.
Plane scale.
Deletes this support plane.
Each seed will create a differently fractured object. Change the seed if you are not happy with the results.
Use this slider to preview the chunks that were generated.
Will also generate colliders each time the chunks are computed.
Will draw lines on the scene view to show how chunks are connected between each other.
Will color chunks in the scene view to show which ones are support chunks and which ones aren't connected to any support chunks directly or indirectly and will fall down when checking for structure integrity.
Will color chunks randomly to see them better in the editor window or in the game window (in the game window in play mode only).
Will save the chunk and collider meshes to an asset file on disk when they are computed. Use this if you want to add this object to a prefab, otherwise the meshes and colliders won't be instanced properly.
Outputs messages and warnings to the console window.
Computes the fractured chunks.
Deletes the fractured chunks.
Use the external Concave Collider utility to have more control over how mesh colliders are generated.
The convex decomposition algorithm. Fast should be the best for 95% of the cases, use the other ones if fast does not work properly.
Limits the maximum vertices a collider hull can have.
Computes the chunk colliders.
Deletes the chunk colliders.