Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently trying to implement basketball bouncing into my game using Box2d (jBox2d technically), but I'm a bit confused about restitution.

While trying to create the ball in the testbed first, I've run into infinite bouncing, as described in this question, however obviously not using my own implementation.

The Box2d manual describes restitution as follows:

Restitution is used to make objects bounce. The restitution value is usually set to be between 0 and 1. Consider dropping a ball on a table. A value of zero means the ball won't bounce. This is called an inelastic collision. A value of one means the ball's velocity will be exactly reflected. This is called a perfectly elastic collision.

My confusion lies in that I am still getting infinite bouncing with restitution values at 0.75/0.8. The same behavior can be seen in the testbed under Collision Watching -> Varying Restitution, on the 6th and 7th balls. I believe the last one has restitution of 1, which makes sense, but I don't understand why the second to last ball bounces infinitely (as is happening with my working basketball I've created).

I am looking to understand the restitution concept more fully, as well as look for a solution to infinite bouncing with the Box2d framework. My instinct was to sleep objects that appeared to be moving in very small increments, but this seems like a misuse of the engine. Should I just work with lower restitution values altogether?

share|improve this question
How is your question different from that one you mentioned? It has good answers. – Anko Feb 18 '13 at 22:46
I'm concerned with the restitution value & bouncing specific to Box2d and its mechanics, rather than my own implementation of bouncing. – lase Feb 19 '13 at 0:01
On my system 6th ball rapidly lost much of its energy, and then begun bouncing with small amplitude forever. I think, it is some kind of lose-end for box2d. May be, setting some linear damping for the ball can fix it. – Pavel Feb 19 '13 at 8:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.