From dd7ffa89dc9b82ba3a86349a378271c0bf9a2b4f Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 25 May 2022 13:55:04 -0400 Subject: [PATCH] Core/Maps: Use a fixed offset instead of full collision height when retrieving floor Z Port From (https://github.com/TrinityCore/TrinityCore/commit/9bcff210f90d57689557b7b8cc20cd336b8ab035) --- Source/Framework/Constants/MapConst.cs | 1 + Source/Game/Entities/Object/WorldObject.cs | 4 ++-- Source/Game/Maps/Map.cs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Framework/Constants/MapConst.cs b/Source/Framework/Constants/MapConst.cs index bb7afa0f9..2bc5a73f7 100644 --- a/Source/Framework/Constants/MapConst.cs +++ b/Source/Framework/Constants/MapConst.cs @@ -56,6 +56,7 @@ namespace Framework.Constants public const float MaxHeight = 100000.0f; public const float MaxFallDistance = 250000.0f; public const float GroundHeightTolerance = 0.05f; + public const float ZOffsetFindHeight = 0.5f; public const float DefaultCollesionHeight = 2.03128f; // Most common value in dbc public const uint MapMagic = 0x5350414D; //"MAPS"; diff --git a/Source/Game/Entities/Object/WorldObject.cs b/Source/Game/Entities/Object/WorldObject.cs index 6ac0ba5af..d962b7ff1 100644 --- a/Source/Game/Entities/Object/WorldObject.cs +++ b/Source/Game/Entities/Object/WorldObject.cs @@ -3601,7 +3601,7 @@ namespace Game.Entities { if (!IsInWorld) return m_staticFloorZ; - return Math.Max(m_staticFloorZ, GetMap().GetGameObjectFloor(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ() + GetCollisionHeight())); + return Math.Max(m_staticFloorZ, GetMap().GetGameObjectFloor(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ() + MapConst.ZOffsetFindHeight)); } public float GetMapWaterOrGroundLevel(float x, float y, float z) @@ -3618,7 +3618,7 @@ namespace Game.Entities public float GetMapHeight(float x, float y, float z, bool vmap = true, float distanceToSearch = MapConst.DefaultHeightSearch) { if (z != MapConst.MaxHeight) - z += GetCollisionHeight(); + z += MapConst.ZOffsetFindHeight; return GetMap().GetHeight(GetPhaseShift(), x, y, z, vmap, distanceToSearch); } diff --git a/Source/Game/Maps/Map.cs b/Source/Game/Maps/Map.cs index 9c74002bd..8460db12a 100644 --- a/Source/Game/Maps/Map.cs +++ b/Source/Game/Maps/Map.cs @@ -1731,7 +1731,7 @@ namespace Game.Maps if (GetGridMap(PhasingHandler.GetTerrainMapId(phaseShift, this, x, y), x, y) != null) { // we need ground level (including grid height version) for proper return water level in point - float ground_z = GetHeight(phaseShift, x, y, z + collisionHeight, true, 50.0f); + float ground_z = GetHeight(phaseShift, x, y, z + MapConst.ZOffsetFindHeight, true, 50.0f); ground = ground_z; LiquidData liquid_status;