Friction in Box2d

Nick Heiner picture Nick Heiner · Apr 2, 2010 · Viewed 8.4k times · Source

I am using Box2d for a topdown game. The "ground" is a series of tiles, where each tile is a static body with a sensor shape. Can I make friction take effect for this, even though the objects aren't really "colliding" with the ground?

If Box2d won't let me do this, I considered trying to implement my own by detecting what force is currently moving the object, and applying a force opposite to it, but I'm not quite sure how to detect that force.

Answer

Colin Gislason picture Colin Gislason · Apr 6, 2010

Another way of doing this is to set linearDamping on your body. You could set this differently depending on the tile your object is on.