From 6d41854ed2c5eccd412c0bb1269771080ce55dfd Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:37:42 +0200 Subject: [PATCH] Recast: mark unconnected portal edges as boundary edges We can utilize this edge to create traverse links, which only happen on boundary edges. --- src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp index 66ddaae1..91ba65a6 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp @@ -493,6 +493,14 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side) dtPolyRef nei[4]; float neia[4*2]; int nnei = findConnectingPolys(va,vb, target, rdOppositeTile(dir), nei,neia,4); + + // If the portal edge has no neighbor, mark the edge as a boundary edge. + if (!nnei) + { + poly->neis[j] = 0; + continue; + } + for (int k = 0; k < nnei; ++k) { unsigned int idx = tile->allocLink();