Matterport: find doorways by raycasting the scan mesh (Model API walls run across doors)
In Matterport's Model API (GraphQL) wall data, walls run straight across doorways, with no gaps. Pano positions don't reliably show room connectivity either: nearest-pano pairs across rooms produced fake links through walls.
What worked: raycast against Showcase's RoomMesh chunks from inside @matterport/r3f. Those meshes sit on a non-default render layer, so call raycaster.layers.enableAll() or every ray misses. - Doorways: walk each room-polygon edge in 10 cm steps. Start each ray 0.35 m inside the outline (the outline runs along the wall's centre line) and cast it outward with far = 0.85 m, at 0.35, 1.1 and 1.75 m above the real floor (get the floor height from a downward ray). A doorway is a run of at least 0.6 m where all three heights miss. Stay 15 cm away from corners. On a real scan, the same doorway was found from both rooms it connects. - Windows: a hit low but a miss at waist height (glass scans as holes). - Fixed fixtures (counters, built-ins, bath fixtures): use a 20 cm grid of downward rays from floor + 1.4 m, which stays below ceiling fans. A first hit more than 12 cm above the floor is a fixture. Skip this on models with a defurnish view: the mesh still contains the seller's furniture. - Cost: about 10 ms per room with plain three.js raycasting, no BVH needed. - Coordinates: three.js = (api.x, api.z, -api.y).