🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Robust swept SAT collision detection in 3D.

Started by
12 comments, last by 123marble 4 years, 1 month ago

@LorenzoGatti I do not believe the above is correct. Going with your example, while it is true that A and B overlap on the axes of A, they do not overlap on all the axes of B. The below example illustrates a separating axis, showing that the shapes do not initially intersect.

I think your example neglects to do a test for for the edge normals of B (as well as the edge normals of A). As such, I still believe that my algorithm does work for any convex shape, so long as all the potentially separating axes are checked.

Advertisement

Seeing that your code operates on an arbitrary set of axes, I assumed it was a fixed set of three axes (two in the 2D case).

Testing the perpendicular direction of each face/edge of each object is not enough (the separating plane might be skew), but it's clearly unsustainable: the cost of the tests grows as the product of the number of vertices and the number of axes.

Omae Wa Mou Shindeiru

@LorenzoGatti Firstly, I would like to make a comment that there is a mistake in my original working above. It is necessary to take the maximum tFirst, not the minimum tFirst to find the earliest time of intersection. I would also like to add that there are obviously other checks that need to be done in the full complete algorithm (for example, if the object is moving away on one axis, then it is not necessary to check the other axes). This email thread explains it much better than my shoddy explanations (sorry!).

However, I do not think this has any effect on the point that you are making above. You mentioned that testing the perpendicular direction of each face/edge is not sufficient to determine intersection. Would you be able to provide an illustrated example for the two 2D boxes where this is the case? In a 3D case, you are correct (it is not sufficient), but you would instead check all the face normals as well as the cross products of the edges (this is what my program does).

This topic is closed to new replies.

Advertisement