Collision detection using separate axis theorem,

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Collision detection using separate axis theorem,

Post by ninwa »

Hey all,

I just wanted to share a great little article which covers how to implement collision detection between rotated polygons, or in this case, rectangles in particular.

http://www.gamedev.net/reference/progra ... /page3.asp

It was recently incredibly useful to me and I thought somebody else might find it interesting. It's written to be specific to rectangles but the algorithm can easily be expanded to any sort of 2D Polygon by increasing the number of axes you test.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Collision detection using separate axis theorem,

Post by zac352 »

I've used this before, I switched over to my on algorithm, which involves a lot of rotating in a relativistic fashion. I'll [eventually] make a tutorial on how to use it. :P
Hello, I am not dead.
User avatar
ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

Re: Collision detection using separate axis theorem,

Post by ninwa »

zac352 wrote:I've used this before, I switched over to my on algorithm, which involves a lot of rotating in a relativistic fashion. I'll [eventually] make a tutorial on how to use it. :P
If you wouldn't mind, I would love to profile the two methods and see which is faster. I don't do a lot of collision checks in the program I'm using this in quite yet, but if I start testing many objects against many objects, the amount of checks will grow exponentially. I thought about a solution involving first rotating one rectangle you're testing to be on the standard plane, rotating the second rectangle by the same angle, and then checking whether or not the vertices of the second rectangle is within its bounds. I decided that since the "separated axis theorem"-method is flexible to support any polygon, I would learn it first.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests