Exploding Enemies

Hi there.

I have made a small doom-style game with some enemies made out of cubes that I have created in Maya LT and I would like to have them explode into pieces when they are killed, kind of like the enemies in Lego games.

Now I’m not sure if this is purely an animation thing or something I might need to do in code or both(I code in C#) and any help or advice is greatly appreciated!

When an enemy is killed, replace it with a prefab of individual cubes, and apply a force in the direction of the player’s shot. Unity’s Physics will take care of the rest.

Hi Tony. Thanks a lot for your reply. I was think that the enemies individual pieces will fall apart (imagine shooting a person made out of Lego or blocks or something). Here is a picture of the enemy. Any more help you can give would be great!

1754251--110975--Robot.JPG

1 Like

The enemy’s mesh looks like it’s made out of 13 primitives. Make another version of this enemy made out of 13 separate GameObjects, each with its own mesh/primitive, and save it as a prefab. When the enemy dies, destroy the original GameObject and instantiate the prefab in its place. Then apply a Physics force to the GameObjects.

If you want to get more elaborate, look into Exploder or this alternative, Mesh Explosion, Fracturing & Destruction, or similar products on the Asset Store.

Just add another thought here. if your mesh is modeled separately, you could just make an animation of falling apart.

This is a collapse animation I used to make,

1 Like

Thanks again Tony. I have decided to use the Cell Fracture feature within Blender which gives me a really good looking crumble effect to the enemy.

Once again thank you for your suggestions and I will definitely keep them in mind!

That collapse animation does look pretty cool. As I said in my previous post I am using the Cell Fracture feature in Blender to give me the desired effect.

Thanks for your reply!