Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
1  
For anyone that doesn't know the game: en.wikipedia.org/wiki/Carrom –  Ray Dey Nov 28 '11 at 12:12
4  
Study some physics and figure it out mathematically. (Worth having some general knowledge in that area anyway if you're a game developer) –  Jonathan Hobbs Nov 28 '11 at 23:00
    
@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, –  ClassicThunder Feb 9 '12 at 23:42
add comment

2 Answers 2

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.

share|improve this answer
1  
Removed my answer because the friction joint is the best way to go about this. –  ClassicThunder Feb 10 '12 at 6:19
add comment

Use setDamping. It acts as air resistance.

object.setDamping(10.4);
share|improve this answer
add comment

Your Answer

 
discard

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

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