I'm working on 2d top down car racing game. Could anyone tell me the simplest way of the detecting the collision between the car (rectangle) and the track edges(lines). The logic I'm currently using is not working as I expected. I tried to check for line to line collision between the car's rectangle (4 lines) and the track lines. Also if it not vector based it would be great, so I could use it right away in my project.