Bounce is an XNA demo application, written to demonstrate collision detection based on Binary Space Partitioning (BSP) trees. It consists of a small tool that can parse a given Wavefront .obj file, and compute a BSP tree from the geometry in the file. The tool writes the generated BSP tree to a file, which in turn can be read by a C# class of the Bounce XNA project.

The Bounce demo application puts the player in an arena in space. Using the keyboard and mouse, the player can navigate freely and a left mouse button press releases a small sphere. The released spheres are simulated by a rigid body physics engine, which lets them bounce off walls and floors of the arena in a physically correct way.

For the collision detection the BSP tree is used, allowing direct sphere-mesh collisions. On my test system (Pentium IV 2.8 Ghz, GeForce 7200LE), approximately 100 spheres can be simulated at 60 FPS, testing more than 7.000.000 triangles in approximately 10 ms for collision. On the graphics side, the demo implements hardware instancing to enable fast drawing of large numbers of spheres. Tangent space normal mapping improves the visual quality.

Demo Features

  • Generation of BSP trees from Wavefront .obj files
  • Direct sphere-mesh collision detection using BSP tree
  • Rigid body physics engine
  • Hardware instancing
  • Normal mapping

Demo Requirements

Update 2011

I’ve ported the demo to XNA 4.0 and updated the code to use the CollidableModel content pipeline plugin. The updated XNA framework simplifies deployment of the built game by allowing creation of an installer package. So in order to run the demo you can simply download the package and run the installer. All dependencies should be installed automatically.


The project sources and binaries are now hosted on google code. For the sake of redundancy you can also download the files directly via the links below.