Implemented collision detection with lines.