From f1e009dc95bb7ea22e1e2829af0cb9f8b09ff2df Mon Sep 17 00:00:00 2001 From: killerwife Date: Thu, 28 Nov 2024 18:40:13 +0100 Subject: [PATCH] Core/Vmaps: Account for model rotation in liquid level Credit: https://github.com/TrinityCore/TrinityCore/commit/53b4501ce9b072cfffe7de7f348094f443e36950 --- src/game/vmap/ModelInstance.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/game/vmap/ModelInstance.cpp b/src/game/vmap/ModelInstance.cpp index 0ac018af1af..74be6250dc1 100644 --- a/src/game/vmap/ModelInstance.cpp +++ b/src/game/vmap/ModelInstance.cpp @@ -140,14 +140,11 @@ namespace VMAP // child bounds are defined in object space: Vector3 pModel = iInvRot * (p - iPos) * iInvScale; // Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f); - float zLevel; - if (info.hitModel->GetLiquidLevel(pModel, zLevel)) + float zDist; + if (info.hitModel->GetLiquidLevel(pModel, zDist)) { // calculate world height (zDist in model coords): - // despite making little sense, there ARE some (slightly) tilted WMOs... - // we can only determine liquid height in LOCAL z-direction (heightmap data), - // so with increasing tilt, liquid calculation gets increasingly wrong...not my fault, really :p - liqHeight = (zLevel - pModel.z) * iScale + p.z; + liqHeight = (Vector3(pModel.x, pModel.y, zDist) * iInvRot * iScale + iPos).z; return true; } return false;