[Solved] Arkanoid in C, SDL3, and Box2D v3. The ball stops bouncing off the block

Hi,

When I set the initial velocity to 3.5, the ball bounces off the block:

b2Body_SetLinearVelocity(ballBodyId, (b2Vec2){0.f, -3.5f}); // Initial velocity
b2Body_SetFixedRotation(ballBodyId, true); // Do not rotate a ball

ball-velocity-3.5-ezgif.com-video-to-gif-converter

But when I set the velocity to 2.9, the ball stops bouncing:

ball-velocity-2.5-ezgif.com-video-to-gif-converter

Source code for the example above on GitHub

Solved:

b2World_SetRestitutionThreshold(worldId, 0.1f);
2 Likes