So I want to do something like this:
Based on this sample I was able to draw OSM maps and add points based on this one.
I wonder how to throw rays between points and see if they intersect with OSM buildings?
First you would want OSM data in vector format where you can get building information in vector form. You may try this source: https://openlayers.org/en/latest/examples/osm-vector-tiles.html Connect points with Line features and use intersect operation to find if any buildings intersect with this lines.