Another rigid-body simulation experiment.

Here i am playing around with dynamically fracturing scene objects into smaller parts, that can either cause other objects to shatter or break into smaller parts themself.

This is kind of a recursive approach where the hit body is replaced by its fracture parts.

Fracturing Process

First, the collision-location (world -> locally) with the maximum applied impulse is computed, and is further used as the fracture-center.

Around the fracture-center an evenly distributed pattern of sampling points is generated. I tried several sampling methods and used jittered Fibonacci samples in the end.

The generated samples and the convex polygon of the original body serve as input for a voronoi structure. The resulting voronoi cells are used to build rigid bodies and replace the original (parent) body.

Libraries

Demo (Runnable Jar)

download (Runnable Jar, any OS): Skylight_BulletPhysics_Breakable.zip

Source: https://github.com/diwi/PixelFlow/tree/master/examples/Skylight_BulletPhysics_Breakable