Hey guys!...

I've got a pretty easy question for you... I can't solve this trivial problem. Probably due to the fact I was coding all day today. I've implemented lots of Vector and Matrix math and the Seperating axis theorem for collision detection. My head buuuuuurnssssss...

It almost works, but it's somehow a little bit "off", when detecting collisions... anyways, here is the code for the computation of the overlaps:

1 2 3 4 5 6 7
| private static boolean noProjOverlap(Vec2 proj0, Vec2 proj1) { return (proj0.x >= (proj1.y) || ((proj0.y) <= proj1.x)); }
private static float projOverlap(Vec2 proj0, Vec2 proj1) { return Math.min(Math.abs(proj0.x - proj1.y), Math.abs(proj0.y - proj1.x)); } |

I use Vec2's for representing projections, where the x field is "min" and the y field is "max".

Followed

this super-duper awesome tutorial.

I've got a problem with the second function: It always returns positive number, obviously due to the "Math.abs"...

The first function works, but it's the function which "produces" this "off"-ness... :/

I'm sure you can help me with this trivial math