Core/Maps: Use a fixed offset instead of full collision height when retrieving floor Z
Port From (https://github.com/TrinityCore/TrinityCore/commit/9bcff210f90d57689557b7b8cc20cd336b8ab035)
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user