Physics engine success

December 14, 2007 at 11:45 pm

This is totally unrelated to my iPhone game, but I really wanted to post about it anyway.

About 3 years ago, I first tried writing a fairly generic physics engine that handled arbitrarily sized axis-aligned boxes in a world composed of arbitrarily sized and angled collision lines. Today I finally succeeded for the first time. No instances of the box sliding through corners or catching in mid-air. It collides when it should and doesn't when it shouldn't.

The secret was something I really should have tried first. Instead of simulating a box in a world, I'm simulating a point in a world with walls that form tighter spaces than they appear to when drawn.