i am working on breakable bodies. For example, i have a single big square box, represented with a box-polygonal shape, as in this video:http://tinypic.com/r/65tp2t/6
In a off-line phase, i create N texture pieces to simulate cracks. Every texture part generated is approximated
with a convex polygon (or more if the convex polygon has too many vertices), that will be used as a fixture
for the part body. The pieces form a perfect subdivision of the original texture.
When it is time, i de-activate (actually, remove from box2d scene) the big box and place all the parts in the
correct position (the big box position + offset of the parte) and orientation (i use the big box orientation).
In the video above, the box is fixed at a position in the screen with a revolute joint. In the test, after few second, i remove the box body
(so the joint is destroyed) and all the small parts are placed in the scene. There is a floor down there even if it is
not represented with a sprite.
In this simple case, it seems to work, but what if the big box body is moving (maybe accelerating, spinning etc...)?
How can i put the small bodies in the box2d world and set their properties in order to keep the simulation 'smooth' (avoiding
unphysical behaviour of the small objects)?
Another way i will try is to create directly the broken body, with distance joints in order to keep it togheter.
When there is a collision, one just destroy the joints (or a part of them, to make things more funny) and let
box2d do the rest.
I wonder if not-perfect texture alignments will show up. Another thing that concerns me is the fact that all that bodies
must be created and at the start of the simulation, while in the other way, they are created only when the body have
to be destroyed. This is clearly faster, even if it could generate some frame rate drops...
Some little pieces are going through the floor, but it should be a bug of mine...