so I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return a true or something like that, no physics involved.
So I started working and couldn't find an algorithm that would check the collision for turned squares.
Here I visualized the problem.
So as you can see squares 1,2 and 3 would return true because they collided with the green squares.
4 would return false because it isn't colliding.
I do have all the squares of both colors in separate array lists.
Does anybody know a lib or algorithm for this problem? Thanks in advance :)
解决方案
Check out the Area class in the java.awt.geom package.