Breakable rigid bodies using Voronoi diagrams

About

You can click anywhere on the canvas to shoot more boxes.

The voronoi diagram is calculated on-the-fly in real-time, and the number of sites is randomized using a random point spray.

Obviously it's not the most efficient way to do that but for the purpose of this demo it is fast enough.

NOTE: This demo is just a simple poc tech demo, might invest more in the future to make this code better written. but for the time being this is just a research/poc/educational project.

Source Code

Can be found on my Github.

Credits

This demo uses matter.js 2D physics engine and Javascript-Voronoi library by gorhill for calculating the voronoi diagram..