Skip to content

Commit

Permalink
Core/Vmaps: Account for model rotation in liquid level
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Nov 28, 2024
1 parent 9a2af04 commit f1e009d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/game/vmap/ModelInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

1 comment on commit f1e009d

@betayi
Copy link

@betayi betayi commented on f1e009d Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReExtract vmap needed?

Please sign in to comment.