# Non axis aligned bounding box collision and physics

Exactly how much more expensive, and while we're at it, difficult, is it to have non-axis aligned bounding boxes in your framework?

I realise that it very much depends on what you're trying to do, so here's a little bit of detail; My small demo framework has a number of bots running around shooting each other. when they die, they explode into cubes. When they're hit, or the bullets miss and hit a wall; more cubes.

At the moment I'm taking advantage of the fact that my framework has no floor, just walls, so you can't really tell if the cubes are resting exactly on the floor or not - as a result I'm using bounding spheres as a cheats collision detection. The main visual problem is when a bot dies from a point blank shot; the middle of the agent blows out backwards but the bottom and top parts sort of collapse into a little pile of cubes.

I'd love to be able to have much more realistic physics on all the cubes so they collide and tumble realistically over one-another.

How would I go about achieving this? and how feasible is it? to have a little physics engine which is just cube on cube.

The bounding sphere solution is an excellent start. I suggest having two spheres instead, one of radius a×sqrt(3)/2 (when those spheres do not collide, you know your cubes do not collide) and one of radius a/2 (when those spheres do collide, you know your cubes also collide).