Examples » Bullet Physics

Integration of Bullet Physics into Magnum.

A rotating table full of cubes that you can shoot down, showcasing the BulletIntegration library together with SceneGraph using BulletIntegration::MotionState. It's also possible to visualize various properties of the Bullet physics world using BulletIntegration::DebugDraw.


Key controls

  • Arrow keys rotate the camera around
  • mouse click shoots an object
  • S toggles between a box (larger, lighter) or a sphere (smaller but heavier) to shoot
  • D toggles draw mode (solid + wireframe debug overlay, just solid or just wireframe debug)


This example was originally contributed by Jan Dupal and further improved by Max Schwarz. The example makes use of the Bullet Physics library, see documentation of the BulletIntegration namespace for license information.


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.