Core/Objects: MovePositonToFirstCollision will now use detour raycasts to determine terrain obstacles
Port From (https://github.com/TrinityCore/TrinityCore/commit/6770987d6f1fe408c78f015ff5bed7f4f5b1715d)
This commit is contained in:
@@ -21,6 +21,7 @@ using Game.AI;
|
|||||||
using Game.BattleFields;
|
using Game.BattleFields;
|
||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
|
using Game.Movement;
|
||||||
using Game.Networking;
|
using Game.Networking;
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using Game.Scenarios;
|
using Game.Scenarios;
|
||||||
@@ -3400,6 +3401,14 @@ namespace Game.Entities
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use a detour raycast to get our first collision point
|
||||||
|
PathGenerator path = new(this);
|
||||||
|
path.CalculatePath(destx, desty, destz, false, true);
|
||||||
|
Vector3 result = path.GetPath()[path.GetPath().Length - 1];
|
||||||
|
destx = result.X;
|
||||||
|
desty = result.Y;
|
||||||
|
destz = result.Z;
|
||||||
|
|
||||||
float halfHeight = GetCollisionHeight() * 0.5f;
|
float halfHeight = GetCollisionHeight() * 0.5f;
|
||||||
UpdateAllowedPositionZ(destx, desty, ref destz);
|
UpdateAllowedPositionZ(destx, desty, ref destz);
|
||||||
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);
|
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user