mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Core/Movement): Fixed collision calculation returning wrong position. (#4879)
This commit is contained in:
@@ -3483,11 +3483,6 @@ bool Map::CanReachPositionAndGetValidCoords(const WorldObject* source, PathGener
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Map::CanReachPositionAndGetValidCoords(const WorldObject* source, float &destX, float &destY, float &destZ, bool failOnCollision, bool failOnSlopes) const
|
||||
{
|
||||
return CanReachPositionAndGetValidCoords(source, source->GetPositionX(), source->GetPositionY(), source->GetPositionZ(), destX, destY, destZ, failOnCollision, failOnSlopes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief validate the new destination and set reachable coords
|
||||
* Check if a given unit can reach a specific point on a segment
|
||||
@@ -3500,16 +3495,19 @@ bool Map::CanReachPositionAndGetValidCoords(const WorldObject* source, float &de
|
||||
* @return true if the destination is valid, false otherwise
|
||||
*
|
||||
**/
|
||||
|
||||
bool Map::CanReachPositionAndGetValidCoords(const WorldObject* source, float& destX, float& destY, float& destZ, bool failOnCollision, bool failOnSlopes) const
|
||||
{
|
||||
return CanReachPositionAndGetValidCoords(source, source->GetPositionX(), source->GetPositionY(), source->GetPositionZ(), destX, destY, destZ, failOnCollision, failOnSlopes);
|
||||
}
|
||||
|
||||
bool Map::CanReachPositionAndGetValidCoords(const WorldObject* source, float startX, float startY, float startZ, float &destX, float &destY, float &destZ, bool failOnCollision, bool failOnSlopes) const
|
||||
{
|
||||
float tempX=destX, tempY=destY, tempZ=destZ;
|
||||
if (!CheckCollisionAndGetValidCoords(source, startX, startY, startZ, destX, destY, destZ, failOnCollision))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
destX = tempX, destY = tempY, destZ = tempZ;
|
||||
|
||||
const Unit* unit = source->ToUnit();
|
||||
// if it's not an unit (Object) then we do not have to continue
|
||||
// with walkable checks
|
||||
@@ -3614,7 +3612,7 @@ bool Map::CheckCollisionAndGetValidCoords(const WorldObject* source, float start
|
||||
source->UpdateAllowedPositionZ(destX, destY, destZ, &groundZ);
|
||||
|
||||
// position has no ground under it (or is too far away)
|
||||
if (groundZ <= INVALID_HEIGHT && unit && unit->CanFly())
|
||||
if (groundZ <= INVALID_HEIGHT && unit && !unit->CanFly())
|
||||
{
|
||||
// fall back to gridHeight if any
|
||||
float gridHeight = GetGridHeight(destX, destY);
|
||||
|
||||
Reference in New Issue
Block a user