• Casts a ray from (x1, y1) to (x2, y2) and returns the first solid cell encountered, or null if the ray passes through air for its entire length.

    Coordinates are floored to integers; the walk uses Bresenham's line algorithm. The hit cell is the cell containing the first solid sample, and distance is the Euclidean distance from (x1, y1) to that cell's integer coordinate.

    Cost: O(line length) — proportional to the longer of |dx| and |dy|.

    Parameters

    Returns HitResult | null