Add breakable (Destructible) objects
Last updated
Last updated
FPS Engine provides several examples of how to use destructible objects. By attaching Destructible.cs to an object with a collider, you can destroy that object, play an audio clip, and spawn loot inside if desired. One example is using Crate.cs, which not only handles the destruction but also spawns a destroyed version of the object. This approach is recommended.
Now, for the destroyed object, you would like to attach an object that has broken pieces in it. See the following image:
Do not forget to attach a collider ( Simple box collider will work fine ) and a rigidbody for the physics to work properly.
But… How can I destroy my model into different pieces?
This example was made using Blender. Blender offers an add-on called Cell Fracture for this. Of course, you can use any other add-on you like.
To enable Cell Fracture go to Blender´s preferences ( edit/ preferences ), and then click on Add-ons.
Search Cell Fracture and enable it.
In object mode, select your model and follow the path: Object/QuickEffects/CellFracture. The next window will pop up
Here, you can customize the fracture as much as you want. Once you are happy, click Ok. Here is the result!