Core/Objects: use the static vmap check in MovePositionToFirstCollision for all path results to avoid falling below wmo surfaces when the mmap path returns unreliable data
Port From (https://github.com/TrinityCore/TrinityCore/commit/b8e1de0f929598c2ebb8da2ee3de99f91be43d14)
This commit is contained in:
@@ -3435,28 +3435,25 @@ namespace Game.Entities
|
|||||||
desty = result.Y;
|
desty = result.Y;
|
||||||
destz = result.Z;
|
destz = result.Z;
|
||||||
|
|
||||||
// Object is using a shortcut. Check static LOS
|
// check static LOS
|
||||||
float halfHeight = GetCollisionHeight() * 0.5f;
|
float halfHeight = GetCollisionHeight() * 0.5f;
|
||||||
if (path.GetPathType().HasFlag(PathType.Shortcut))
|
bool col = Global.VMapMgr.GetObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap(), pos.posX, pos.posY),
|
||||||
|
pos.posX, pos.posY, pos.posZ + halfHeight,
|
||||||
|
destx, desty, destz + halfHeight,
|
||||||
|
out destx, out desty, out destz, -0.5f);
|
||||||
|
|
||||||
|
destz -= halfHeight;
|
||||||
|
|
||||||
|
// Collided with static LOS object, move back to collision point
|
||||||
|
if (col)
|
||||||
{
|
{
|
||||||
bool vmapCol = Global.VMapMgr.GetObjectHitPos(PhasingHandler.GetTerrainMapId(GetPhaseShift(), GetMap(), pos.posX, pos.posY),
|
destx -= SharedConst.ContactDistance * MathF.Cos(angle);
|
||||||
pos.posX, pos.posY, pos.posZ + halfHeight,
|
desty -= SharedConst.ContactDistance * MathF.Sin(angle);
|
||||||
destx, desty, destz + halfHeight,
|
dist = MathF.Sqrt((pos.posX - destx) * (pos.posX - destx) + (pos.posY - desty) * (pos.posY - desty));
|
||||||
out destx, out desty, out destz, -0.5f);
|
|
||||||
|
|
||||||
destz -= halfHeight;
|
|
||||||
|
|
||||||
// Collided with static LOS object, move back to collision point
|
|
||||||
if (vmapCol)
|
|
||||||
{
|
|
||||||
destx -= SharedConst.ContactDistance * MathF.Cos(angle);
|
|
||||||
desty -= SharedConst.ContactDistance * MathF.Sin(angle);
|
|
||||||
dist = MathF.Sqrt((pos.posX - destx) * (pos.posX - destx) + (pos.posY - desty) * (pos.posY - desty));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check dynamic collision
|
// check dynamic collision
|
||||||
bool col = GetMap().GetObjectHitPos(GetPhaseShift(), pos.posX, pos.posY, pos.posZ + halfHeight, destx, desty, destz + halfHeight, out destx, out desty, out destz, -0.5f);
|
col = GetMap().GetObjectHitPos(GetPhaseShift(), pos.posX, pos.posY, pos.posZ + halfHeight, destx, desty, destz + halfHeight, out destx, out desty, out destz, -0.5f);
|
||||||
|
|
||||||
destz -= halfHeight;
|
destz -= halfHeight;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user