mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
Fix /unstuck to use full floor search via camera reset
The previous approach used getFloorHeight which has tight spatial query bounds and couldn't find WMO floors far above the player. Now uses reset() which does multi-radius WMO/terrain scanning.
This commit is contained in:
parent
3c2a728ec4
commit
84c3d1bf32
2 changed files with 5 additions and 25 deletions
|
|
@ -50,6 +50,7 @@ public:
|
||||||
const glm::vec3& getDefaultPosition() const { return defaultPosition; }
|
const glm::vec3& getDefaultPosition() const { return defaultPosition; }
|
||||||
bool isMoving() const;
|
bool isMoving() const;
|
||||||
float getYaw() const { return yaw; }
|
float getYaw() const { return yaw; }
|
||||||
|
float getPitch() const { return pitch; }
|
||||||
float getFacingYaw() const { return facingYaw; }
|
float getFacingYaw() const { return facingYaw; }
|
||||||
bool isThirdPerson() const { return thirdPerson; }
|
bool isThirdPerson() const { return thirdPerson; }
|
||||||
bool isGrounded() const { return grounded; }
|
bool isGrounded() const { return grounded; }
|
||||||
|
|
|
||||||
|
|
@ -530,36 +530,15 @@ void Application::setupUICallbacks() {
|
||||||
loadOnlineWorldTerrain(mapId, x, y, z);
|
loadOnlineWorldTerrain(mapId, x, y, z);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unstuck callback — snap player Z to WMO/terrain floor height
|
// Unstuck callback — re-run spawn search at current XY to find valid floor
|
||||||
gameHandler->setUnstuckCallback([this]() {
|
gameHandler->setUnstuckCallback([this]() {
|
||||||
if (!renderer || !renderer->getCameraController()) return;
|
if (!renderer || !renderer->getCameraController()) return;
|
||||||
auto* cc = renderer->getCameraController();
|
auto* cc = renderer->getCameraController();
|
||||||
auto* ft = cc->getFollowTargetMutable();
|
auto* ft = cc->getFollowTargetMutable();
|
||||||
if (!ft) return;
|
if (!ft) return;
|
||||||
// Probe floor at current XY from high up to find WMO floors above
|
// Use reset() which does a full multi-radius WMO/terrain floor search
|
||||||
auto* wmo = renderer->getWMORenderer();
|
cc->setDefaultSpawn(*ft, cc->getYaw(), cc->getPitch());
|
||||||
auto* terrain = renderer->getTerrainManager();
|
cc->reset();
|
||||||
float bestZ = ft->z;
|
|
||||||
bool found = false;
|
|
||||||
// Probe from well above to catch WMO floors like Stormwind
|
|
||||||
float probeZ = ft->z + 200.0f;
|
|
||||||
if (wmo) {
|
|
||||||
auto wmoH = wmo->getFloorHeight(ft->x, ft->y, probeZ);
|
|
||||||
if (wmoH) {
|
|
||||||
bestZ = *wmoH;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (terrain) {
|
|
||||||
auto terrH = terrain->getHeightAt(ft->x, ft->y);
|
|
||||||
if (terrH && (!found || *terrH > bestZ)) {
|
|
||||||
bestZ = *terrH;
|
|
||||||
found = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (found) {
|
|
||||||
ft->z = bestZ;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Faction hostility map is built in buildFactionHostilityMap() when character enters world
|
// Faction hostility map is built in buildFactionHostilityMap() when character enters world
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue