From 35119988379e65c9508c8e3ec1a85173dea1647f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:20:55 +0200 Subject: [PATCH] Recast: fix sliced path finder bug See https://github.com/recastnavigation/recastnavigation/issues/438 --- src/thirdparty/recast/Detour/Source/DetourNavMeshQuery.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMeshQuery.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMeshQuery.cpp index 63a71cd0..ff5c63fa 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMeshQuery.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMeshQuery.cpp @@ -1363,9 +1363,13 @@ dtStatus dtNavMeshQuery::updateSlicedFindPath(const int maxIter, int* doneIters, if (!filter->passFilter(neighbourRef, neighbourTile, neighbourPoly)) continue; + unsigned char crossSide = 0; // See https://github.com/recastnavigation/recastnavigation/issues/438 + + if (bestTile->links[i].side != 0xff) + crossSide = bestTile->links[i].side >> 1; // get the neighbor node - dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, 0); + dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide); if (!neighbourNode) { m_query.status |= DT_OUT_OF_NODES;