Examples » Box2D

A simple example using the Box2D physics library.

Builds a pyramid out of cubes and allows you to expand or destroy it by adding more. Uses the SceneGraph library directly with Box2D.


Key controls

  • mouse click adds a cube to cursor position


This example was originally contributed by Michal Mikula.


Full source code is linked below and also available in the magnum-examples GitHub repository.

The ports branch contains additional patches for Emscripten support that aren't present in master in order to keep the example code as simple as possible.