From b2d0db40efdfff93329793a4246388584e0225ec Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Thu, 19 Sep 2024 00:11:49 +0200 Subject: [PATCH] Recast: properly flag off-mesh connection polygons MSET 7 or higher needs proper off-mesh connection flags. --- src/naveditor/OffMeshConnectionTool.cpp | 9 +++++++-- src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/naveditor/OffMeshConnectionTool.cpp b/src/naveditor/OffMeshConnectionTool.cpp index da00862b..d0e252ab 100644 --- a/src/naveditor/OffMeshConnectionTool.cpp +++ b/src/naveditor/OffMeshConnectionTool.cpp @@ -128,8 +128,13 @@ void OffMeshConnectionTool::handleClick(const float* /*s*/, const float* p, bool } else { - const unsigned char area = EDITOR_POLYAREA_JUMP; - const unsigned short flags = EDITOR_POLYFLAGS_WALK; + const unsigned char area = DT_POLYAREA_JUMP; + const unsigned short flags = DT_POLYFLAGS_WALK +#if DT_NAVMESH_SET_VERSION >= 7 + | DT_POLYFLAGS_JUMP; +#else + ; +#endif; geom->addOffMeshConnection(m_hitPos, p, m_radius, m_bidir ? 1 : 0, (unsigned char)m_traverseType, m_invertVertexLookupOrder ? 1 : 0, area, flags); m_hitPosSet = false; diff --git a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp index 3c3b610c..2f9bf166 100644 --- a/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp +++ b/src/thirdparty/recast/Detour/Source/DetourNavMesh.cpp @@ -672,7 +672,11 @@ dtStatus dtNavMesh::connectOffMeshLinks(const dtTileRef tileRef) return DT_FAILURE | DT_OUT_OF_MEMORY; } - // Off-mesh links have been established, break out entirely. +#if DT_NAVMESH_SET_VERSION >= 7 + // Off-mesh link is fully linked, mark it. + conPoly->flags |= DT_POLYFLAGS_JUMP_LINKED; +#endif + // All links have been established, break out entirely. breakOut = true; break; }