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
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