Mesh Fracturing

Made a project that demonstrates a dynamic destruction using physics. Some key features:

  • Mesh to mesh collisions using Ammo.
  • Mesh fracture using voronoi diagrams and delaunay triangulation.
  • Polygon to mesh generation to create those fragments.
  • Vertex colors to have different colors on the surface and “inside” the mesh.


I could only imagine all the creative ways that this can be used in future playcanvas projects. If you have a good enough computer! By the way, great job on the environment, it looks fantastic.

You know what would save some performance and optimize that script a bit. You could make it so that after the object breaks, a timer starts, and after a certain amount of time, all the fragments disappear. By doing this the GPU will have an easier time running the project since it doesn’t have to always be rendering the fragments that are on the ground.

1 Like

So fantastic!

1 Like

Thanks, guys :slight_smile: Yes, as I mentioned in Discord, there are many ways to optimize this. I was happy to ignore most of the optimizations for this was supposed to be an example :slight_smile:

Perhaps, I could make another pass on it and add optimizations, if there is interest. Or someone could do it as well, as it is easy to fork projects.

One optimiation, as @DinoCalebProductions mentioned, could be on the debris. The fragments colliders don’t need to live forever, and could have relatively short life. The visual mesh can stay - there is no performance issue, as the fragments are batched. One could simply disable rigidbody and collision components on the fragments to remove them from the physics simulation. Or use a better physics engine :wink: