I'm implementing my own Raycasting library to learn how it works. As a starting point I have a box that rotates and, using rays, detects the different obstacles that it encounters in its way. Worth mention: I have this working using the line AABB intersection method. The following image show how it works:
My problem comes when I rotate one of the above walls and try to use the same method to check the collision of the rays:
I've looking for a possible solution to correct that, using different algorithms like the Separating Axis Theorem and Cohen-Sutherland but I couldn't find anything that works similar to AABB intersection but using OBB. Any ideas how to round the problem in the second picture where it collides with the boundaries of the object when it's rotated? I'm using Unity and C#.