From ff7fd29008f53d054a6a84cbe52bd52bee2a24a5 Mon Sep 17 00:00:00 2001 From: Mikko Mononen Date: Mon, 6 Feb 2012 14:54:00 +0000 Subject: [PATCH] Potential fix for navmesh query crash when using off-mesh cons and no BV-tree. --- Detour/Source/DetourNavMeshQuery.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Detour/Source/DetourNavMeshQuery.cpp b/Detour/Source/DetourNavMeshQuery.cpp index 0114cbc..bb1ae67 100644 --- a/Detour/Source/DetourNavMeshQuery.cpp +++ b/Detour/Source/DetourNavMeshQuery.cpp @@ -584,10 +584,13 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi for (int i = 0; i < tile->header->polyCount; ++i) { const dtPoly* p = &tile->polys[i]; + // Do not return off-mesh connection polygons. + if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) + continue; + // Must pass filter const dtPolyRef ref = base | (dtPolyRef)i; if (!filter->passFilter(ref, tile, p)) continue; - // Calc polygon bounds. const float* v = &tile->verts[p->verts[0]*3]; dtVcopy(bmin, v);