mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix floor cache for multi-story buildings
Skip cached floor height if it's too far below query point (>4 units), forcing a full raycast. This handles cases where the cache has a different floor's height (e.g., ground floor cached while on upper floor).
This commit is contained in:
parent
d1e9bbeb1f
commit
e768f5048c
1 changed files with 4 additions and 2 deletions
|
|
@ -1392,8 +1392,10 @@ std::optional<float> WMORenderer::getFloorHeight(float glX, float glY, float glZ
|
|||
auto gridIt = precomputedFloorGrid.find(gridKey);
|
||||
if (gridIt != precomputedFloorGrid.end()) {
|
||||
float cachedHeight = gridIt->second;
|
||||
// Only use if cached height is below query point (not a ceiling)
|
||||
if (cachedHeight <= glZ + 2.0f) {
|
||||
// Only use cache if floor is close to query point (within ~4 units below).
|
||||
// For multi-story buildings, the cache has the top floor - if we're on a
|
||||
// lower floor, skip cache and do full raycast to find actual floor.
|
||||
if (cachedHeight <= glZ + 2.0f && cachedHeight >= glZ - 4.0f) {
|
||||
return cachedHeight;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue