Trying out line detection method This is the result. It uses the same principle as my first line detection, but with the 2 corners of the hit box. By taking the 2 corners of the hit box, you can use the slope formula to see if the box has the outer lines overlapping the intersection points, and if so, you are touching it. but you only need 2 corners to get 4 sides, halving the number of calculations I thought necessary. However, if the line you are detecting has a backwards slope, you have to change the points to the top right and bottom left instead, as that gives you the proper locations to overlap. TO DO: Improve line width calculations