From a548d9f9b021a54cfc9013b7e104ccf524e88358 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 2 May 2020 00:06:34 +0200 Subject: 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 --- src/server/game/Entities/Object/Object.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 352fb8554a5..05f62aa1394 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -3283,24 +3283,21 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float desty = result.y; destz = result.z; - // Object is using a shortcut. Check static LOS + // check static LOS float halfHeight = GetCollisionHeight() * 0.5f; - if (path.GetPathType() & PATHFIND_SHORTCUT) - { - bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), - pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight, - destx, desty, destz + halfHeight, - destx, desty, destz, -0.5f); + bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), + pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight, + destx, desty, destz + halfHeight, + destx, desty, destz, -0.5f); - destz -= halfHeight; + destz -= halfHeight; - // Collided with static LOS object, move back to collision point - if (col) - { - destx -= CONTACT_DISTANCE * std::cos(angle); - desty -= CONTACT_DISTANCE * std::sin(angle); - dist = std::sqrt((pos.m_positionX - destx) * (pos.m_positionX - destx) + (pos.m_positionY - desty) * (pos.m_positionY - desty)); - } + // Collided with static LOS object, move back to collision point + if (col) + { + destx -= CONTACT_DISTANCE * std::cos(angle); + desty -= CONTACT_DISTANCE * std::sin(angle); + dist = std::sqrt((pos.m_positionX - destx) * (pos.m_positionX - destx) + (pos.m_positionY - desty) * (pos.m_positionY - desty)); } // check dynamic collision -- cgit v1.2.3