I'm using awt
and it's been working great. However, I need to detect the side that one object hits another. For a rectangle, it'd be a simple math, however for another shape (let's say text), it's not as simple.
For example, I have a 'player' (a rectangle shape) which moves with the arrow keys, and a text with a collision box matching the text (a shape matching the text).
If the player went in between letters, then collided into the right side of a letter, I would want it to be distinguished as right, not left (like the rectangle example would most likely would be).
I already have the collision detection done, that's not the issue. I want to detect the face (left, right, top, bottom) where the collision happened.
In other words, if someone made a custom shape, with two rectangles inside of it, but the center is blank between them, I want to detect which face the collision happened. So, if I have the left rectangle on the right side, I want to know that I hit the right side, and if I hit the right rectangle on the left side, I want to know that I hit the left side.
Is this possible? And if so, is it practical?