Core/PathFinding: Return raycast hitpoint when specifying straightLine

Port From (https://github.com/TrinityCore/TrinityCore/commit/313b9d2531830e6470132beb3c131527a50b9d50)
This commit is contained in:
hondacrx
2022-01-07 11:03:10 -05:00
parent 6dde0557c6
commit e71512b36e
@@ -359,7 +359,15 @@ namespace Game.Movement
if (hit != float.MaxValue)
{
// the ray hit something, return no path instead of the incomplete one
pathType = PathType.NoPath;
Clear();
_polyLength = 2;
Array.Resize(ref _pathPoints, 2);
_pathPoints[0] = GetStartPosition();
float[] hitPos = new float[3];
Detour.dtVlerp(hitPos, startPoint, endPoint, hit);
_pathPoints[1] = new Vector3(hitPos[2], hitPos[0], hitPos[1]);
pathType = PathType.Incomplete;
return;
}
}
@@ -424,7 +432,15 @@ namespace Game.Movement
if (hit != float.MaxValue)
{
// the ray hit something, return no path instead of the incomplete one
pathType = PathType.NoPath;
Clear();
_polyLength = 2;
Array.Resize(ref _pathPoints, 2);
_pathPoints[0] = GetStartPosition();
float[] hitPos = new float[3];
Detour.dtVlerp(hitPos, startPoint, endPoint, hit);
_pathPoints[1] = new Vector3(hitPos[2], hitPos[0], hitPos[1]);
pathType = PathType.Incomplete;
return;
}
}