Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm making a pool-game like game. This game requires correct (or very accurate) reflective bounces. I tried Box2D and Bullet Physics, but they both have this problem.


If there is a wall on top of this image, red line is expected course of a real ball in a pool-game. But the engines often shows green line course. Especially,

  1. This happens after a slowly moving ball hits the wall.
  2. Sometimes a rapidly moving ball get slower suddenly.

I'm finding a physics engine which can simulate pool-game accurately as much as possible without these problems. Can I get some recommendations? Now I'm digging Newton Game Dynamics, but I am not sure the engine will show what I want. I'm considering the PhysX engine as a next trial, and have to make my own if nothing works. But it's obvious it'll take very long time, so I wish I won't do that. I'll be very appreciated if you save my time. And of course, solution with Box2D / Bullet Physics are also welcomed.

I am working with C/C++/Objective+C on iOS.

I attach my configuration with Box2D.


  • static box shape
  • linear/angular damping = 0.1
  • restitution = 1.0
  • friction = 100
  • density = 10
  • bullet = false
  • fixed rotation = false
  • inertial scale = 1.0


  • dynamic sphere shape
  • linear/angular damping = 0.1
  • restitution = 1.0
  • friction = 100
  • density = 20
  • bullet = true
  • fixed rotation = false
  • inertial scale = 1.0
share|improve this question

closed as off-topic by Byte56 Dec 22 '13 at 5:11

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are about "which tech to use" are outside the scope of the site. For more information, see this meta post" – Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

chances are that the engine is not wrong, but you've not set a property or doing it wrong somehow. –  The Communist Duck May 6 '11 at 16:37
possible duplicate of Is there an algorithm for a pool game? –  bummzack May 7 '11 at 16:31
I tested with density 1 and friction 0.0 ~ 0.1, it keeps sticking. –  Eonil May 10 '11 at 7:54

4 Answers 4

up vote 8 down vote accepted

Several solutions.

  1. For Box2D, set b2_velocityThreshold in b2Settings.h file. In my case, I set it to 0.0f and it worked! Mass, friction, damping were NOT problem. Check this discussion thread for more details.

  2. Using other physics engine. Newton Game Dynamics configured performing this correctly by default. However using Newton dynamics in iOS is possible but it's somewhat harder than others. I used several days configuring it for iOS.

I'm also asking on BulletPhysics forums. I'll update this when I got a solution.

-- (edit) --

There are some threshold attributes in Bullet, however I couldn't find exactly same thing with b2_velocityThreshold.

This looks similar, but didn't work well.

share|improve this answer

Box2D will do what you want but you have to set the restitution (bounce) constants for the wall and ball fixtures. For a pool game you probably want to start with perfect restitution and high friction but linear and angular damping, and tweak from there.

share|improve this answer
I tried many configurations over few days, but it still happens. Can I get one good example...? –  Eonil May 7 '11 at 1:33
Your density and friction values seem very large, for Box2D. –  user744 May 7 '11 at 9:56

Physics engines have a bounce threshold. I don't know how to do it in either of those engines, but the threshold being set too high will cause it to ignore impacts under a certain velocity. Lower the bounce threshold and it will bounce at lower speeds.

I know you asked for a different physics engine, but all physics engines I know of use bounce thresholds to keep objects from jittering when they're sitting on top of each other. So suggesting a good physics engine will be counterproductive as any good physics engine will have this effect.

share|improve this answer

I had this problem and for me the solution was providing perfect restitution.

So for me that is sqrt of 0.5 for all objects. Because sqrt(r1*r1 + r2*r2) == 1 in perfect situation.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.