0
votes

Hy, i´m doing a game with a flat platform looked from upside, and i has circles on it that i can move.

Here an example:

example

I dont know how to make a Box2D object so it apply friction force to objects on it, theres not so much code about it, most examples was a rear view which objects are on top and has bottom gravity.

Most examples i´ve found:

    world=new World(new Vector2(0, -100), true);

My case:

    world=new World(new Vector2(0, 0), true);

I hope u can understand me.

EDIT: I think this fit my needs

FrictionJointl

But i cant understand how to use it.

1

1 Answers

0
votes

Use Body.setLinearDamping() and Body.setAngularDamping() on your circles. That will automatically apply friction to them. Alternatively you may do this yourself by using Body.applyLinearImpulse() and Body.applyAngularImpulse() in the opposite direction of your velocity/rotation.