mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30: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);
|
auto gridIt = precomputedFloorGrid.find(gridKey);
|
||||||
if (gridIt != precomputedFloorGrid.end()) {
|
if (gridIt != precomputedFloorGrid.end()) {
|
||||||
float cachedHeight = gridIt->second;
|
float cachedHeight = gridIt->second;
|
||||||
// Only use if cached height is below query point (not a ceiling)
|
// Only use cache if floor is close to query point (within ~4 units below).
|
||||||
if (cachedHeight <= glZ + 2.0f) {
|
// 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;
|
return cachedHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue