saving Box2D world state

hey folks,

I've been experimenting with box2d, since it was used in angrybirds, to make similar structures like those of the game

My problem is that my structures, built up from bricks, collapse after running the physic world, even when the position of the bricks match "exactly" one on top and next to each other, like those in a wall. Some times my structures "bounce" or restitute to an equilibrium state, only after they try to collapse

Observing closely those structures in angrybirds, they appear to "step" from its initial position, when the level has just started, jumping to an equilibrium position, each object resting on top or next to each other, and not collapsing like mines

So I was wondering if:

1) do I need to anchor each brick to its initial position, with a junction or applying forces, and run the physic simulation until they reach an equilibrium to avoid their collapse

2) can I save the state of the physical world after my structures are in equilibrium, in order to them to be loaded the next time I run the game

Any help will be appreciated

Thanks very much
The reason why Angry Birds' structures are stable is because they're made up of (mostly) pillars and beams, not bricks. Box2D doesn't handle a lot of bodies stacked on top of each other (and in some cases you'll see the bottom bodies are overlapping each other). Numerous stacked bodies do tend to bounce (sometimes never resting), so lots of bricks are not actually ideal for stable structures because of how Box2D works.

It is a good idea, though, to sort of "freeze" the bricks until the first launch or hit (or whatever) if you're having problems with keeping a stable brick structure.

And yes, you can save the state of the physical world by storing each body's position and angle (and for joints, their anchors, the bodies they're connected to, etc). If they're all one-fixture bodies with no joints, this is extremely easy.
that's a very useful info

thanks my friend

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