# 2D SAT Collision - Triangle and Square Problem

So I was just doing an example 2D SAT collision detection problem on paper when I encountered something unexpected. I ran the algorithm on a triangle and a square, and the result of the algorithm was that there was a collision, when indeed there was not. Take a look at this:

grey lines are the axes, red marks are extremes of projection endpoints (from both shapes) on each axis I was under the impression that the SAT algorithm checked for overlapping vertices on all unique axes generated by both shapes sides' normals, and if no gap is found on any axis, then there is a collision. It looks like that does not work in this example. Can someone explain what I am missing? Maybe I'm understanding the algorithm wrongly.

• There's a gap when you project onto the normal to the triangle's hypotenuse (the diagonal green lines), is there not? – DMGregory Nov 1 '17 at 23:07
• @DMGregory Wait so we are supposed to project onto the normals? or the lines perpendicular to the normals? – Ibrahim Nov 1 '17 at 23:10
• Well, which one finds the separating axis in this case? That should tell you all you need. ;) – DMGregory Nov 1 '17 at 23:12
• Wow, no wonder all my other polygons were having the same issue, thanks man! – Ibrahim Nov 1 '17 at 23:16
• If you've solved your problem, try writing up your solution as an answer so it can benefit future users. :) – DMGregory Nov 1 '17 at 23:17 