I have a loop that builds 2 stacks of 50 bricks each on top of each other. I want these bricks to be dynamic because I’m going to be knocking them over and I want to see them collide with each other.
The problem I’m having is that when I run this, the bricks initially compress - they act as if they are somewhat squishy, rather than completely rigid, and so the stacks bow out and collapse. If I decrease the number of objects I’m stacking to 10, they stay put (but still seem to squish together initially before expanding again).
How can I pile up large numbers of dynamic objects without this effect?
local building = display.newGroup(); local startPos = { x = 600, y = display.actualContentHeight - ground.height }; local curPos = { x = 600, y = display.actualContentHeight - ground.height }; for count = 1, 100, 1 do local newBrick = display.newImage(building, "brick.jpg", curPos.x, curPos.y ); physics.addBody(newBrick, "static", { friction = 10, bounce = 0.0, density = .2 }); if count % 2 == 0 then curPos.x = startPos.x; if(count ~= 0) then curPos.y = curPos.y - newBrick.height; end else curPos.x = curPos.x + newBrick.width; end end