1
votes

Now I am working on carrom like game using cocos2d + Box2d. I set world gravity(0,0)..to make gravity on z-axis. Is it proper or any other value?

I set following value for coin striker body:

  Coin body: 
         density = 20.0f;
         friction = 0.4f;
         restitution = 0.6f;
         Shape Circle with radius - 15/PTM_RATIO

  Striker body: 
         density = 25.0f;
         friction = 0.6f;
         restitution = 0.3f;
         Shape Circle with radius - 15/PTM_RATIO

Output is not smooth, when I apply ApplyLinearImpulse(force,position);

Coin movement looks like floating in air....takes too much time to stop...

Which value of coin and striker makes it look like real carom?

1

1 Answers

2
votes

The problem that you're having is that friction is only applied when two bodies are colliding. Since the coin is just floating in air, there's no resistance being applied. To fix this and apply a very rough approximation of air resistance, you should set the linearDamping property of the body's definition:

bodyDef.linearDamping = 0.5f;

Try experimenting with different values until it looks right to you.