Monday, August 20, 2007

Integrating Erin Catto's Box2D Library

I put in my time this week attempting to merge the functionality of Erin Catto's Box2D example physics library into my program.

My current box/box contact determination code only returns one contact (the most-penetrating point), so resting contact between boxes (with two contact points) doesn't work quite right yet. The contacts involving discs work fine since those only ever have one point anyway.

Erin's library assumes that all collisions are perfectly inelastic, so you can't make things bounce. The code for computing contact impulses in the normal direction assumes that we want the relative velocity to be zero and does its best to enforce that. This looks like it'll be a bit of work to untangle.



I found a cool little side-scrolling tank game called Terav by Ben Roth that does a lot of what I'm aiming for. Unfortunately it won't run under Windows Vista; it was created with GameMaker, several versions of which apparently just don't work under Vista. There are actually quite a lot of games that can't be run because of this. Fortunately I have an old machine with Windows XP on it so I was able to try out Terav. It's punishingly difficult (at least for me) but it does seem to have nice vehicle physics and it does a good job with enemy design.

No comments: