Improve floor detection for multi-story buildings

- Increase footprint sampling radius from 0.28 to 0.4 units
- Only update floor cache if found floor is close to query height
- Prevents caching wrong floor from different stories
This commit is contained in:
Kelsi 2026-02-05 17:46:30 -08:00
parent e768f5048c
commit bf6a5ba596
2 changed files with 7 additions and 5 deletions

View file

@ -1495,8 +1495,10 @@ std::optional<float> WMORenderer::getFloorHeight(float glX, float glY, float glZ
}
}
// Cache the result in persistent grid (never expires)
if (bestFloor) {
// Cache the result in persistent grid.
// Only update cache if we found a floor that's close to query height,
// to avoid caching wrong floors when player is on different stories.
if (bestFloor && *bestFloor >= glZ - 6.0f) {
precomputedFloorGrid[gridKey] = *bestFloor;
}