I am working on carrom like game using cocos2d + Box2D. I set world gravity(0,0), want gravity in z-axis. I set following values for coin and striker body:

Coin body (circle with radius - 15/PTM_RATIO):

density = 20.0f;
friction = 0.4f;
restitution = 0.6f;

Striker body (circle with radius - 15/PTM_RATIO):

density = 25.0f;
friction = 0.6f;
restitution = 0.3f;

Output is not smooth. When I apply ApplyLinearImpulse(force,position) the coin movement looks like floating in the air - takes too much time to stop.

What values for coin and striker make it look like real carrom?

  • 1
    \$\begingroup\$ For anyone that doesn't know the game: en.wikipedia.org/wiki/Carrom \$\endgroup\$ – Ray Dey Nov 28 '11 at 12:12
  • 4
    \$\begingroup\$ Study some physics and figure it out mathematically. (Worth having some general knowledge in that area anyway if you're a game developer) \$\endgroup\$ – doppelgreener Nov 28 '11 at 23:00
  • \$\begingroup\$ @Jonathan Hobbs Not really fair as the issue here is related to the library and no amount of correct math would fix the problem out side of making his own engine, \$\endgroup\$ – ClassicThunder Feb 9 '12 at 23:42

Box2D comes with a FrictionJoint. From the docs:

The friction joint is used for top-down friction. The joint provides 2D translational friction and angular friction.

As far as I know it doesn't really matter what you attach your physics-bodies to (using the joint). So you could attach them all to a border of the play-board and tweak the friction/torque settings until it looks realistic.

  • 1
    \$\begingroup\$ Removed my answer because the friction joint is the best way to go about this. \$\endgroup\$ – ClassicThunder Feb 10 '12 at 6:19

Use setDamping. It acts as air resistance.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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