Building Collapsing due to elasticity

I'm trying to build the skeleton of a building using only rectangles of the same size(the floors are horizontal and walls vertical rectangles, I have 3-4 levels). The problem is that the structure seems to be very elastic and oscillates after is bing created, then collapsed. I'm using the following parameters for the boxes: friction, density and restitution.

Code:
var boxDef:b2PolygonDef = new b2PolygonDef();
boxDef.SetAsBox(w, h);
boxDef.friction = 1;
boxDef.density = 1;
boxDef.restitution = 0;


Do you have any idea how I can fix it? I want to have a solid structure and the density > 0. I've tried different densities, friction and restitutions, but the problem persists. Is there any other parameter or any trick?
If you make the house out of one body with many shapes, it'll be perfectly rigid. That is probably not what you want though.

Stacking things is frequently problematic. You should up the velocity iterations, though it costs performance.

You can also try increasing inertiaScale, which is an experimental stability feature for wobbliness.
BorisTheBrave wrote:
If you make the house out of one body with many shapes, it'll be perfectly rigid. That is probably not what you want though.

Stacking things is frequently problematic. You should up the velocity iterations, though it costs performance.

You can also try increasing inertiaScale, which is an experimental stability feature for wobbliness.


Thanks, as you said I don't want to be perfectly rigid, like a single object. I want to have multiple rectangles arranged to 3-4 levels building that can be destroyed when I throw something.

I'll try both the things you suggested and I'll post the results here.

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