Good 2D Collision Response References

Jeff picture Jeff · Jul 15, 2010 · Viewed 24.4k times · Source

Hey, I'm currently looking for various methods of implementing collision response in 2D video games, something similar to this tutorial Metanet has: N Tutorial I'm looking to implement something in XNA, but any language would be fine. I'm more interested in implementing programmatically than actual theory. I'd prefer more beginner friendly material, but I do welcome more advance topics.

So could someone suggest some good 2D collision response articles/books?

(PS: I'm more interested in response than detection)

Answer

Patrick Klug picture Patrick Klug · Aug 23, 2010

The N tutorial that you mentioned already is a great resource to start with. I also recommend the very good article 2D Polygon Collision Detection. It comes with a great C# implementation and example for polygon collision detection using the Separating Axis Theorem and explains some of the concepts better.

As far as responding to a collision is concerned it depends on the scenario. For games you might want to check for a possible collision based on the current velocity and then simply adjust the actual velocity to prevent collision. You could also implement some sort of 'bounce' effect. In any case it will likely be adjusting both the velocity and direction of the object.

You can use the Separating Axis Theorem to do the collision detection and also use polygon projection to find the distance to the target on a specific axis. (most of the time the vector on which you move).