a problem with collision detection...

Started by
9 comments, last by Zakwayda 14 years ago
Quote:Original post by Bru
well, i managed to find out how to check which side is the side i collide with,yet not get the intersection point.
pretty much i am suppoused to take the dot product of each side's normal and the velocity,and check which one is closest to -1. the one that is closest to it is the side where the collision happens.
It sounds like you might be doing something different than the typical swept AABB test. I suppose the method you described would work (I've never tried it), but the 'real' swept AABB test will tell you *exactly* when and where the collision occurred, so no guessing is required.
Quote:but that still leaves me without an intersection point,and i cant use a ray since it could miss...
Keep in mind that in the general case, two axis-aligned boxes will not touch at a single point, but will instead share a contact manifold consisting of a line segment. Depending on what you need the collision info for though, you can reduce this to a single contact point (e.g. by using the segment midpoint).

Once you've computed the time of impact using the continuous SAT test, you can clip the colliding features together to yield the contact manifold. All this stuff is fairly straightforward, and has been discussed a lot in the math and physics forum here on GDNet in the past. Straightforward or not though, it can be kind of a pain to implement. I certainly don't want to discourage you from doing it yourself if that's what you prefer, but I'll go ahead and mention again the option of using an existing physics library (which can save a great deal of time and effort).

This topic is closed to new replies.

Advertisement