0
\$\begingroup\$

Hi I am working on barrier detection.

I used this swept aabb algorithm http://www.gamedev.net/page/resources/_/technical/game-programming/swept-aabb-collision-detection-and-response-r3084.

It suggests two ways to detect collision. 1. broadphase: this is a shorter-algorithm which can only detect non-collision 100%. 2. In order to make sure that there is a collision, the more detailed swept aabb algorithm has to be executed right after the broadphase one.

Strangely the broadphase algorithm alone detects a barrier collision each and every time and the more precise one actually doesn't at all times.

What I do in my code is basically the following: My object moves towards the barrier with a constand speed vx = direction * speed * delta (that's the amount it moves each frame). So positionx = positionx + (direction * speed * delta) each frame. The broadphase-collision is calculated each frame by using vx and vy.

Are there some rare cases where the broadphase can actually detect a collision like in this one I described? Thanks so much for your help

Thanks so much

\$\endgroup\$
0
\$\begingroup\$

For reference, this is the broad-phasing:

AABB broad phase

The broad phase works 100% if the other object always overlaps with the swept area if it ever overlaps with the broad phase area. Usually this means axis-aligned barriers that are either infinite length, or whose ends/corners aren't inside the broad phase area.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.