Re:How I implemented 2D collision detection in Pistol Slut
by mcav on Wednesday January 19, 2011 @04:31PM
(#2121348)
This page helped me understand the Minkowski sum visually: http://www.pfirth.co.uk/minkowski.html
Essentially this makes the intersection calculation easier at the expense of computing the Minkowski sum. However, computing the Minkowski sum is trivial in certain cases, and the axis-aligned square "grenade" intersecting with a line segment is one of them:
You can treat the grenade as a point and inflate the line segment by the grenade's dimensions in x and y to make a rectangle. Then you can sweep the point to make a line segment representing the grenade's movement and intersect it with the rectangle. This gives you the exact intersection point, much as in the case of the bullet/bin intersection, without needing to incrementally search along the grenade's path.
http://en.wikipedia.org/wiki/Minkowski_addition