In the last few days I wrote a physics engine from scratch using a technique that no other 3D XNA physics engine (that I know of) uses yet: Speculative contact continuous collision detection.
I’ve been looking for a good physics engine for this game for a while now, and my favorite so far is BEPU. If you need a physics engine for your game, BEPU is pretty awesome. They went open source just recently, and their simulation is extremely stable and pretty accurate. They support all sorts of constraints, and Norbo is constantly monitoring and responding to questions on the forum.
That said, my game idea relies on having potentially hundreds of spheres in the world at once, and with an entire single CPU core devoted to the physics on the XBOX (plus the physics management on the draw core) I was only able to simulate 20-30 spheres at a 20FPS physics update, and that was only if they were all reasonably spaced apart.
However, I don’t need the precision of BEPU, and for most spheres, I don’t care if they have accurate 3D angular momentum. BEPU also doesn’t exploit the properties of my game world, such as the fact that physically simulated objects are rarely on top of one-another. So, I decided to write my own engine, taking all of these special cases into account.
Paul Firth wrote a post about speculative contacts, a continous collision detection approach to physics simulation.
Using this idea, I’ve created a simple CCD physics engine. While there are drawbacks to this approach, it’s suitable for my purposes, and remarkably stable with just one solver iteration. This together with the exploitation of the special case for physics in this game, should prove to be much more efficient.
Above is a recording of the engine in action. Sphere and plane collisions are currently handled. This is 99% of the work for sphere-terrain collision, which is almost everything I need to add this into the game.
This physics engine already uses the same spatial partitioning approach used in the game (two grids which act as the bottom two levels of a complete quad-tree).