Collision Detection with Different Shapes
Well the title says it all. I know how to do collision detection with circles and squares (that aren't at an angle), but I want to be able to do more than that. I've done some google searching and found the Gilbert-Johnson-Keerthi algorithm, and while it seems to be what I need... I think some important maths were looked over in my high school curriculum... namely Vector math.
Now my two specific questions:
1 - Is there a simpler definition (or one that explains more on the assumed knowledge) of the GJK algorithm?
2 - Is the GJK algorithm the only algorithm that can do this? Am I even right in assuming that it can?
Quote:1 - Is there a simpler definition (or one that explains more on the assumed knowledge) of the GJK algorithm?GJK is pretty involved (and can be a little non-intuitive as well). There are some good references on the subject, though. Gino van den Bergen's book in particular is good, although it's pretty math- and theory-heavy.
Quote:2 - Is the GJK algorithm the only algorithm that can do this? Am I even right in assuming that it can?No and yes.
Perhaps you could tell us what shapes you're interested in supporting, whether you need to perform continuous (swept) tests, and what information you need the test to return (e.g. time of intersection, contact manifold, etc.). Based on that, we can recommend some other algorithms to look into.
Quote:GJK is pretty involved (and can be a little non-intuitive as well). There are some good references on the subject, though. Gino van den Bergen's book in particular is good, although it's pretty math- and theory-heavy.
I'm fine with something being math and theory intensive, I was just wondering if there was a reference that just taught the specific parts of the various maths needed for the algorithm.
Quote:Perhaps you could tell us what shapes you're interested in supporting, whether you need to perform continuous (swept) tests, and what information you need the test to return (e.g. time of intersection, contact manifold, etc.). Based on that, we can recommend some other algorithms to look into.
Well it's 2D collision detection for a shoot 'em up. The shapes would be polygons and circles (or an approximation of them) such as squares, triangles, stars, etc. The test needs to be done every frame, and it just needs to return that a collision happened.
I was originally thinking of doing collision detection by putting the hitboxes onto a different image or plane, and checking for pixel overlaps, but since they can be moved at any direction, pixel by pixel detection wouldn't work as well as I want it... I think.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement