I’ve got a simple physics engine that solves collisions by simply correcting the position of overlapping bodies (just circles for now) directly, as opposed to just changing the velocity or applying an impulse. Velocity is only changed after impacts are already resolved, or during the integration part.
I’ve had the problem that in heaps of objects the top objects apply too much pressure (this exists implicitly, there’s no pressure modelling in the algorithm) on the objects at the bottom of the heap, which results in them getting pushed through floors, etc.
I wanted to fix this by sorting the objects by their y-coordinate, so the collisions are resolved bottom-up. But now, the engine shows weird popping behavior for objects which should actually be at rest (see gif)
Without just giving you the source code – what could this be?