Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I think this is a very straighforward question, lets say i have a building in 2D, a rectangle shape. Now i want to decompose that area in a lot of convex shapes, as seen in a voronoi diagram, or closely like it, just so I can add those shapes to the physics engine, and have a realistic destruction.

Bonus: Possible suggestions on how to make the effect more dynamic and interesting.

Please keep in mind we re talking about realtime calculations..

share|improve this question

Well, you could literally generate a Voronoi diagram. That is, produce some random points in the rectangle, find their Delaunay triangulation (google for the algorithms for this), then generate the Voronoi polygons from the triangulation. The Delaunay triangulation is the dual graph of the Voronoi diagram, so there will be one Voronoi vertex for each triangle, with the Voronoi edges running perpendicular to the triangle edges.

That sounds heavyweight, but it depends on how many pieces you want each building to break into and how often you need to break a building. You might spread the computation across multiple frames or something, if it causes too much of a spike.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.