I setup a simple simulation environment something like billiards. There are four circle balls (dynamic) and four box walls (static).

Simulation works... except one thing. Sometimes when a ball rest against a wall, it sticks to the wall eternally. The other balls hits the stuck ball so many times, but the ball never wants to separated with the wall. The only situation where the ball will become unstuck from the wall is another if another ball is rests against the same wall such that it hits the already-stuck ball.

Why does this situation occur? How can I avoid it?


2 Answers 2


Try changing b2_velocityThreshold variable in b2Settings.h - this setting keeps the simulation stable by ignoring tiny bounces but that's probably not what you want in a billiards game.

  • \$\begingroup\$ You're right. The parameter was exactly what I have been found. Anyway, I have discussion already here: gamedev.stackexchange.com/q/12003 Thank you for answering :) \$\endgroup\$
    – Eonil
    Aug 2, 2011 at 5:55

Most likely, you have collision resolution code that reverses (reflects) the direction that the ball is going when it hits the wall. If the ball's position penetrates the wall slightly and stays there until the next frame, it may sense a collision again be reversing direction again (and each frame thereafter) and stay stuck.

Typically, if you sense a collision with the wall, in addition to reflecting the ball's direction, you should also make sure you position it on the side where it won't sense a collision next frame.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .