Core/Vmaps: Fix inconsistency of hitInstance and hitModel to cause wrong area ids (#28632)

Closes #19761
Closes #28326

Co-authored-by: Gosha <284210+Lordron@users.noreply.github.com>
(cherry picked from commit 6ce6665992)
This commit is contained in:
ModoX
2022-12-30 00:02:40 +01:00
committed by Shauren
parent cf27f1cf39
commit 225a1bbf7d
5 changed files with 17 additions and 4 deletions

View File

@@ -116,7 +116,9 @@ namespace VMAP
Vector3 pModel = iInvRot * (p - iPos) * iInvScale;
Vector3 zDirModel = iInvRot * Vector3(0.f, 0.f, -1.f);
float zDist;
if (iModel->GetLocationInfo(pModel, zDirModel, zDist, info))
GroupLocationInfo groupInfo;
if (iModel->GetLocationInfo(pModel, zDirModel, zDist, groupInfo))
{
Vector3 modelGround = pModel + zDist * zDirModel;
// Transform back to world space. Note that:
@@ -125,6 +127,8 @@ namespace VMAP
float world_Z = ((modelGround * iInvRot) * iScale + iPos).z;
if (info.ground_Z < world_Z) // hm...could it be handled automatically with zDist at intersection?
{
info.rootId = groupInfo.rootId;
info.hitModel = groupInfo.hitModel;
info.ground_Z = world_Z;
info.hitInstance = this;
return true;