Using two nails is an implicit way to specify that you want those two bodies to be rigidly connected; it would probably be better to use one nail and an orientation constraint, or a rigid constraint if there is one (haven't checked the latest build).
Box2D supports multiple shapes per body. This is called a compound shape. I suggest making a weld tool that will join two shapes into a single rigid body.
Both you guys are right. But nails are added bu user at runtime, and it is intuitive that two or more nails result i rigid connection.
Also - while nails are added and removed at runtime, creating single body from multiple shapes is undoable.
If joint with equal limits will work, i'll provide user with special nail ("bolt") which results in rigid connection.
Thanks for help!
It all depends on how you architect your editor code. You can have each girder be a separate entity that points to a shared rigid body. You can detect that two girders are joined by more than one nail and create a single rigid body that is shared. When one nail is removed your can reprocess all the girders and find that the two girders now have seperate bodies.
Of course this is not as easy. You'll have to do some graph analysis (e.g. depth first search). It really depends on how much stability you require.
You could check if a girder has two nails connecting it to another girder, and if it does, set the limits of both nails so that it can't rotate. Whenever they remove a nail from a girder, you can just loop through the array of joints for that object, updating their limits 🙂