diff options
| author | Giacomo Pozzoni <giacomopoz@gmail.com> | 2020-02-28 19:29:58 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-12-22 14:59:46 +0100 |
| commit | 313b9d2531830e6470132beb3c131527a50b9d50 (patch) | |
| tree | a4c74ed75c3f5190dd3907d036f5d7e69d66f936 /src | |
| parent | aa4ee9278f827368708e7a4b8df4fe9be634de6a (diff) | |
Core/PathFinding: Return raycast hitpoint when specifying straightLine (#24206)
(cherry picked from commit 6443e518cfa110434617c26f949b6783fe4d10d3)
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Movement/PathGenerator.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 1fb640cf3c5..d6fda8eeedb 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -370,7 +370,15 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (hit != FLT_MAX) { // the ray hit something, return no path instead of the incomplete one - _type = PATHFIND_NOPATH; + Clear(); + _polyLength = 2; + _pathPoints.resize(2); + _pathPoints[0] = GetStartPosition(); + float hitPos[3]; + dtVlerp(hitPos, startPoint, endPoint, hit); + _pathPoints[1] = G3D::Vector3(hitPos[2], hitPos[0], hitPos[1]); + + _type = PATHFIND_INCOMPLETE; return; } } @@ -433,7 +441,15 @@ void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 con if (hit != FLT_MAX) { // the ray hit something, return no path instead of the incomplete one - _type = PATHFIND_NOPATH; + Clear(); + _polyLength = 2; + _pathPoints.resize(2); + _pathPoints[0] = GetStartPosition(); + float hitPos[3]; + dtVlerp(hitPos, startPoint, endPoint, hit); + _pathPoints[1] = G3D::Vector3(hitPos[2], hitPos[0], hitPos[1]); + + _type = PATHFIND_INCOMPLETE; return; } } |
