From 739d59057430366ad449e5644d90f81fc6947d6a Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 22 Aug 2024 01:14:49 +0200 Subject: [PATCH] Recast: ignore off-mesh links for traverse links Do not link or union off-mesh links to traverse links. --- src/naveditor/Editor.cpp | 6 ++++++ .../recast/Detour/Source/DetourNavMeshBuilder.cpp | 10 +++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/naveditor/Editor.cpp b/src/naveditor/Editor.cpp index f2fdf427..9716362c 100644 --- a/src/naveditor/Editor.cpp +++ b/src/naveditor/Editor.cpp @@ -794,6 +794,9 @@ void Editor::connectTileTraverseLinks(dtMeshTile* const baseTile, const bool lin if (basePoly->groupId == DT_UNLINKED_POLY_GROUP) continue; + if (basePoly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) + continue; + for (int j = 0; j < basePoly->vertCount; ++j) { // Hard edges only! @@ -868,6 +871,9 @@ void Editor::connectTileTraverseLinks(dtMeshTile* const baseTile, const bool lin if (landPoly->groupId == DT_UNLINKED_POLY_GROUP) continue; + if (landPoly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) + continue; + for (int m = 0; m < landPoly->vertCount; ++m) { if (landPoly->neis[m] != 0) diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp index bf48abb1..2a08f825 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMeshBuilder.cpp @@ -426,6 +426,9 @@ static void unionTraverseLinkedPolyGroups(const dtTraverseTableCreateParams* par { dtPoly& poly = tile->polys[j]; + if (poly.getType() == DT_POLYTYPE_OFFMESH_CONNECTION) + continue; + for (int k = poly.firstLink; k != DT_NULL_LINK; k = tile->links[k].next) { const dtLink* link = &tile->links[k]; @@ -434,13 +437,6 @@ static void unionTraverseLinkedPolyGroups(const dtTraverseTableCreateParams* par if (link->traverseType == DT_NULL_TRAVERSE_TYPE) continue; - // note(amos): here we want to possible change several things up. - // Ideally we create a disjoint set for each anim type (5 for small, - // 1 for everything beyond) and determine the traversability here - // with use of a lookup table that has to be made still. - // Anim type 0 (HUMAN) for example, cannot jump as high as anim type - // 2 (STALKER). - const dtPoly* landPoly; const dtMeshTile* landTile;