For now I only know how to do this out of a first person perspective for axis aligned bounding boxes.
It works by sending out a ray and then checking if it hits the box. Then you can get back a normal of the surface (not implemented in my code though!!
) and the parameter of the length of the ray at the point where it hit the box.
Here is my implemented code. It is right out of my source, so there might be weird comments or stuff because I am too lazy to go through it again.
But one hint: the getMin(X) and getMax(Y) methods give back the coordinates of the ends of the box on the specified axes.http://pastebin.java-gaming.org/dc73e721252
Other than that I am just not experienced enough to know anything else.
I am not even sure if it helps you, someone else will put this right, I hope.