Hello,
I’m making a puzzle game that uses a simple grid of squares. For the most part, I don’t use physics, but when the user loses the game I turn the 8x8 grid of rects into physics bodies and apply random impulses to them so I can simulate an “explosion” animation. The only physics bodies are the rects from the grid. The effect looks pretty good! Here’s what I’m doing:
physics.start() for i = 1, gridGroup.gridWidth do for j = 1, gridGroup.gridHeight do physics.addBody(tiles[i][j].rect) tiles[i][j].rect:applyLinearImpulse( (math.random(10) - 5) \* 0.03, (math.random(10) - 5) \* 0.03, tiles[i][j].rect.x, tiles[i][j].rect.y ) tiles[i][j].rect:applyTorque( (math.random(10) - 5) \* 0.02 ) end end
But maybe 1/3 the time this animation fires, everything seems to get stuck and jitters for a second. As best I can tell, it appears that some of the rects are partially intersecting each other and getting stuck, and it remedies itself very quickly, but it’s quite noticeable.
Any ideas?