I've implemented some collision detection using separating axis theorem. Works fine for axis-aligned rectangles and two out of four possible right triangle orientations. For some reason when the hypotenuse is oriented down left or up right, the minimum translation vector being calculated is that of the normal of the base or height of the triangle rather than the hypotenuse that is being collided with.
https://i.sstatic.net/W5WHH.png
I've got a jsfiddle demo of my implementation. The center box and right side triangles all show a correct MVT when the collision box collides with them. The ones on the left side do not. Move your mouse over the canvas to move the collision box.
checkNormal
. \$\endgroup\$