Understanding Box2D kinematic bodies

So you are used to work with Box2D and know everything about body types, such as static bodies and dynamic bodies… why nobody talks about kinematic bodies?

I think kinematic bodies are great to do some tasks, but first let me briefly explain the difference among body types.

A dynamic body is a body which is affected by world forces and react to collisions. And you already met a million of them.

A static body is a body which isn’t affected by world forces it does not react to collisions. It can’t be moved. Fullstop.

A kinematic body is an hybrid body which is not affected by forces and collisions like a static body but can moved with a linear velocity like a dynamic body.

So I made this little, commented script where dynamic spheres fall down at every second in a world full of moving kinematic bodies. The effect is unique and can be used in some games.

This is the result:

Also look how debug draw shows kinematic bodies.

Download the source code.