aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2020-05-02 00:06:34 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-01 23:49:31 +0100
commitb8e1de0f929598c2ebb8da2ee3de99f91be43d14 (patch)
tree858acc8242a421e1ede28ae4a35550a22f67fec7 /src
parent6d94bc2f4b23c51a69213a46b28a5e97aa99f5d5 (diff)
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
(cherry picked from commit a548d9f9b021a54cfc9013b7e104ccf524e88358)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Object/Object.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index 6ae346f26de..5e24ce2d606 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -3222,28 +3222,25 @@ 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(PhasingHandler::GetTerrainMapId(GetPhaseShift(), GetMap(), pos.m_positionX, pos.m_positionY),
- 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(PhasingHandler::GetTerrainMapId(GetPhaseShift(), GetMap(), pos.m_positionX, pos.m_positionY),
+ 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
- bool col = GetMap()->getObjectHitPos(GetPhaseShift(),
+ col = GetMap()->getObjectHitPos(GetPhaseShift(),
pos.m_positionX, pos.m_positionY, pos.m_positionZ + halfHeight,
destx, desty, destz + halfHeight,
destx, desty, destz, -0.5f);