When people talk about game physics, they’re really talking about three different things.
1) the actual physics of a ball being affected by gravity, elasticity, and air drag.
2) collision detection; knowing when the ball touches the wall.
3) collision resolution; Handling the ball bouncing off the wall and not penetrating it.
I’m doing that right now in some procedural research I’m doing, and I’m pretty happy with my approach so far.
What I’m doing is…Making a collision box around everything I’m not supposed to penetrate, and excluding the player from that box. I detect that the player winds up in the box after applying all my forces, and if so, I move the player out towards the nearest face.
Now, there can be some problems with this method. First, the player can slip between two collision boxes that abut each other. The solution is simple; make them overlap a bit.
Another problem occurs if the player tries to move into the concave corner formed by two coll boxes. You don’t really want them to overlap in that case, since it causes a weird join the player can get hung up on. But if you don’t overlap them, the player can slip right thru between them. The answer is to put a third coll box (or just a coll face, facing the concavity) in the join. A coll column works well, too.
Still, this is a nice system, since you never have to worry about starting your move inside something (which can get you trapped inside a coll box, using other methods). You also don’t need to bother stepping out of the coll box plus a little bit, like I’ve had to do on other projects. Also, the system meshes perfectly with a Verlet physics system.
Nowadays, there are really good physics systems you can get for free. These systems start with their own assumptions, but they encompass all three of the things I mentioned at the top of this post. One day I’m gonna have to check them out.