Recently I’ve posted this GIF on Reddit and it received surprisingly good feedback, so I decided to post about how to achieve this effect using Blender and Unity3D.

First of all, you need an object with good geometry, no disconnected vertices or edges, no internal faces or areas with zero thickness. Sometimes you can repair your model with the triangulate modifier. If your model does not have proper topology the Cell Fracture function will fail and you will not obtain the desired results.

Next, enable the Cell Fracture add-on function in Blender under File > User Preferences…

Now you can use the grease pencil to mark the impact areas. In the image below the maximum fracturing will occur in the center. Make sure you are drawing in a layer inside the object in hierarchy, and that stroke placement is set to surface.

Next, find the Cell Fracture Tool in the left side of the screen. You can tweak these values to obtain different results, but make sure to set Point Source to Grease Pencil, and to increase noise so that the fractures look more natural. Keep source limit to a minimum, as this will determine how many shards will be generated and can cause performance issues if you use real time physics.

This is the end result after cell fracturing.

Now you can import both the intact model and the fractured one into Unity. You can switch between them once the player hits the wall. I check for this event with OnTriggerEnter.

void OnTriggerEnter(Collider other) { if(other.CompareTag("PlayerHitbox")) { Instantiate(fracturedWall, transform.position, transform.rotation); Destroy(gameObject); } }

Finally you can add the Rigidbody component, the Mesh Collider component, and a “DestroyOverTime” script component to each of the shards of the fractured wall.

Performance Issues

As reddit user Novezz has mentioned, this method can be performance heavy, as Unity’s physics engine is doing lots of real time calculations for collisions of each shard of the fractured object. Here follow some important considerations:

Check Convex at the mesh colliders, this makes the physics calculations simpler for the game engine.

at the mesh colliders, this makes the physics calculations simpler for the game engine. Instantiate as few shards as possible. Tweak the source limit parameter in the cell fracture function to obtain a different amount of shards.

parameter in the cell fracture function to obtain a different amount of shards. Destroy the shards as soon as possible, you can make fancy dissolve or shrink effects to make it seem more believable.

Consider using primitive colliders for the shards instead of mesh colliders if performance is a real issue (mobile platforms).

Consider baking the destroy animation instead of using real time physics at all if you don’t need it to look dynamic. If you’re concerned that the animation might look repetitive, you could create different clips that are randomly picked by mecanim once the object is destroyed.

BONUS: Breaking a Building

In order to add extra physics fun to the game you can make it so that the object only breaks if impact force is big enough. This is achievable by using the relativeVelocity collision property.

void OnCollisionEnter(Collision collision) { if (collision.relativeVelocity.magnitude > breakLimit) { SpawnFracturedObject(); Destroy(gameObject); } }

This way you could treat each individual floor of a building as a different block object, all of them stacked to look like a skyscraper. If a cannonball is thrown with enough force at the lowest floor, the whole thing will gradually go down crashing piece by piece.

Conclusions

Breaking stuff is fun and surprisingly easy to implement! More games should let us break stuff in fun and different ways. If you find this article helpful or if you would like to share different methods please let me know, now go break some shit up!