Core/PathFinding: Return raycast hitpoint when specifying straightLine
Port From (https://github.com/TrinityCore/TrinityCore/commit/313b9d2531830e6470132beb3c131527a50b9d50)
This commit is contained in:
@@ -359,7 +359,15 @@ namespace Game.Movement
|
|||||||
if (hit != float.MaxValue)
|
if (hit != float.MaxValue)
|
||||||
{
|
{
|
||||||
// the ray hit something, return no path instead of the incomplete one
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,7 +432,15 @@ namespace Game.Movement
|
|||||||
if (hit != float.MaxValue)
|
if (hit != float.MaxValue)
|
||||||
{
|
{
|
||||||
// the ray hit something, return no path instead of the incomplete one
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user