Super rigid welds

Hi there.

I know that many of you who use Box2D seek for solution of welding more bodies together in chains where the result remains rigid. Box2D provides a weld joint, but the iterative solver can't produce good results when there are more welds in chain. I'd like to show you that it is possible to achieve good results with a little creativity, and although i am not releasing a code solution (mostly because it's tied to my game engine instead of box2D itself) i am going to describe the solution so you can try implement it yourself. It's not too complicated, but debugging took me a really long time.

Video:
http://youtu.be/ZDot18EF3yQ

The upper chain of bodies uses default weld joints.
The chain below uses super rigid welds.
Superwelds produce a new body, but original bodies still exist, inactive and not participating in the simulation, however their position / velocity is being updated by the superweld so game entities don't have to worry about it.

The first part shows the performance and rigidity as well as splitting to multiple superwelds when some bodies are removed.
Second half demostrates how joints are additionally created on superwelds and how they rejoint to newly produced superwelds (after "cutting" it half) or to original bodies
Superwelding can be done dynamically (though not shown in the video). The superweld keeps track of pairs: which bodies are welded to which (just like normal welds connect 2 bodies) though it doesn't affect it unless some bodies are removed. In that case superwelds perform a floodfill over the bodies and pairs and separate/generate new bodies
Yeah, this is how I recommend people create breakable bodies. You can see the breakable demo in the testbed. Still, thanks for the example. I'm sure this will help people.
Hi Erin,

the "BreakableBody" has the big disadvantage, that i only can break the whole body at once - or is there a approach where i breaks phyiscally correct?
Imagine that each frame you gather all the forces on a breakable body then you do some sort of stress analysis to see how it should break. Each breakable link between shapes could then break independently based on the stress analysis. This way you can have hierarchical breaking. We used this a little bit in Diablo 3 and based on a GDC presentation, this is how the Red Faction games create large scale destruction of buildings.

Original thread: https://box2d.org/forum/viewtopic.php?t=7979