I'm writing an elementary gravity simulation where a square falls to the ground and bounces with damping. However, after a few good bounces, the square seems to get 'stuck' in the floor - it does not rebound with the expected impulse. After this happens, it continues to do little mini-bounces in the floor, but without damping. Why is this happening? This code: