Thomas Sampson

Advanced 2D collision detection

Leave a comment

This is a great article written by explaining how to achieve accurate collision detection between two dimensional objects using the “Separating Axis Theorem”.

Although this tutorial deals with the collision of rectangular objects (so would apply to bounding boxes around 2D shapes rather than pixel based collision detection), this is not limited to axis aligned rectangles. This allows the algorithm to check for collision with rotated boxes rather than the less useful axis aligned collision detection approach (hitTest() in flash anyone?).

I have finished reading the tutorial and intend to form a c++ implementation in the near future. Although some parts may need a quick re-read, this method is not as complicated as it might first appear. A word of warning, this kind of collision detection should only be triggered by a less accurate method. By this I mean that if you have a large collection of objects which require collision checking, do some simple tests firsts to check that they arent a mile apart (the radius test is suggested in the article).

Only if the result of a simpler algorithm suggest that the two shapes are in close proximity, should we go ahead and make use of the more resource expensive approach presented here. Running the algorithm suggested in this article would be wasteful if it was to be executed all the time on all objects regardless of the distance between them.


Author: tomtech999

I have recently graduated with a 1st class degree in MComp Games Software Development at Sheffield Hallam University, focusing primarily on application development in C++, with experience in graphics programming, scripting languages, DVCS/VCS and web technology. In my spare time I enjoy Drumming, Reading and Snowboarding!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s