UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DetourNavMeshQuery.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2// Modified version of Recast/Detour's source file
3
4//
5// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
6//
7// This software is provided 'as-is', without any express or implied
8// warranty. In no event will the authors be held liable for any damages
9// arising from the use of this software.
10// Permission is granted to anyone to use this software for any purpose,
11// including commercial applications, and to alter it and redistribute it
12// freely, subject to the following restrictions:
13// 1. The origin of this software must not be misrepresented; you must not
14// claim that you wrote the original software. If you use this software
15// in a product, an acknowledgment in the product documentation would be
16// appreciated but is not required.
17// 2. Altered source versions must be plainly marked as such, and must not be
18// misrepresented as being the original software.
19// 3. This notice may not be removed or altered from any source distribution.
20//
21
22#ifndef DETOURNAVMESHQUERY_H
23#define DETOURNAVMESHQUERY_H
24
25#include "CoreMinimal.h"
26#include "Detour/DetourAlloc.h"
27#include "Detour/DetourCommon.h"
30#include "Detour/DetourStatus.h"
32
33//@UE BEGIN
34#define WITH_FIXED_AREA_ENTERING_COST 1
35
36// Note poly costs are still floats in UE so we are using FLT_MAX as unwalkable still.
37#define DT_UNWALKABLE_POLY_COST FLT_MAX
38//@UE END
39
40// By default dtQueryFilter will use virtual calls.
41// On certain platforms indirect or virtual function call is expensive. The default
42// setting is to use non-virtual functions, the actual implementations of the functions
43// are declared as inline for maximum speed.
44// To avoid virtual calls create dtQueryFilter with inIsVirtual = false.
45
46// Special link filter is custom filter run only for offmesh links with assigned UserId
47// Used by smart navlinks in UE
48//
50{
52
55
56 virtual bool isLinkAllowed(const unsigned long long int UserId) const { return true; }
57
58 UE_DEPRECATED(5.3, "LinkIds are now based on a 64 bit uint. Use the version of this function that takes an unsigned long long int")
59 virtual bool isLinkAllowed(const int UserId) const final { return true; }
60
62 virtual void initialize() {}
63};
64
65// [UE: moved all filter variables to struct, DO NOT mess with virtual functions here!]
67{
68 dtReal m_areaCost[DT_MAX_AREAS];
69#if WITH_FIXED_AREA_ENTERING_COST
70 dtReal m_areaFixedCost[DT_MAX_AREAS];
71#endif // WITH_FIXED_AREA_ENTERING_COST
74
75 unsigned short m_includeFlags;
76 unsigned short m_excludeFlags;
77
79 //@UE BEGIN
85 //@UE END
86
88
89 NAVMESH_API bool equals(const dtQueryFilterData* other) const;
91};
92
96{
97protected:
100
101public:
104 virtual ~dtQueryFilter() {}
105
106protected:
107
109 inline bool passInlineFilter(const dtPolyRef ref,
110 const dtMeshTile* tile,
111 const dtPoly* poly) const
112 {
113 return (poly->flags & data.m_includeFlags) != 0 && (poly->flags & data.m_excludeFlags) == 0
117#endif // WITH_FIXED_AREA_ENTERING_COST
118 ;
119 }
120
122 virtual bool passVirtualFilter(const dtPolyRef ref,
123 const dtMeshTile* tile,
124 const dtPoly* poly) const
125 {
126 return passInlineFilter(ref, tile, poly);
127 }
128
129public:
131 bool getIsVirtual() const { return isVirtual; }
132
137 inline bool passFilter(const dtPolyRef ref,
138 const dtMeshTile* tile,
139 const dtPoly* poly) const
140 {
141 return !isVirtual ? passInlineFilter(ref, tile, poly) : passVirtualFilter(ref, tile, poly);
142 }
143
144protected:
145
147 inline dtReal getInlineCost(const dtReal* pa, const dtReal* pb,
148 const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
149 const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
150 const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const
151 {
152#if WITH_FIXED_AREA_ENTERING_COST
153 const dtReal areaChangeCost = nextPoly != 0 && nextPoly->getArea() != curPoly->getArea()
154 ? data.m_areaFixedCost[nextPoly->getArea()] : 0.f;
155
156 return dtVdist(pa, pb) * data.m_areaCost[curPoly->getArea()] + areaChangeCost;
157#else
158 return dtVdist(pa, pb) * data.m_areaCost[curPoly->getArea()];
159#endif // #if WITH_FIXED_AREA_ENTERING_COST
160 }
161
163 virtual dtReal getVirtualCost(const dtReal* pa, const dtReal* pb,
164 const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
165 const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
166 const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const
167 {
168 return getInlineCost(pa, pb,
172 }
173
174//@UE BEGIN Adding support for LWCoords.
175#if !DT_LARGE_WORLD_COORDINATES_DISABLED
176 // This function is deprecated call the version on this function that takes FReal
177 virtual float getVirtualCost(const float* pa, const float* pb,
178 const dtPolyRef prevRef, const dtMeshTile* prevTile, const dtPoly* prevPoly,
179 const dtPolyRef curRef, const dtMeshTile* curTile, const dtPoly* curPoly,
180 const dtPolyRef nextRef, const dtMeshTile* nextTile, const dtPoly* nextPoly) const final
181 {
182 check(false); // This function is deprecated use the version of this function that takes FReal
183 return 0.f;
184 }
185#endif
186//@UE END Adding support for LWCoords.
187
188public:
210
213
217 inline dtReal getAreaCost(const int i) const { return data.m_areaCost[i]; }
218
222 inline void setAreaCost(const int i, const dtReal cost) { data.m_areaCost[i] = cost; data.lowestAreaCost = dtMin(data.lowestAreaCost, cost); }
223
224//@UE BEGIN
225 inline const dtReal* getAllAreaCosts() const { return data.m_areaCost; }
226
227#if WITH_FIXED_AREA_ENTERING_COST
231 inline dtReal getAreaFixedCost(const int i) const { return data.m_areaFixedCost[i]; }
232
236 inline void setAreaFixedCost(const int i, const dtReal cost) { data.m_areaFixedCost[i] = cost; }
237
238 inline const dtReal* getAllFixedAreaCosts() const { return data.m_areaFixedCost; }
239#endif // WITH_FIXED_AREA_ENTERING_COST
240
242
245 inline dtReal getHeuristicScale() const { return data.heuristicScale; }
246
249
252 inline bool isValidLinkSide(const unsigned char side) const
253 {
254 return (side & DT_LINK_FLAG_OFFMESH_CON) == 0 || (side & DT_LINK_FLAG_OFFMESH_CON_BIDIR) != 0
255 || (data.m_isBacktracking ? (side & DT_LINK_FLAG_OFFMESH_CON_BACKTRACKER) != 0
256 : (side & DT_LINK_FLAG_OFFMESH_CON_BACKTRACKER) == 0);
257 }
258
261
264 inline bool getIsBacktracking() const { return data.m_isBacktracking; }
265
268
272//@UE END
273
277 inline unsigned short getIncludeFlags() const { return data.m_includeFlags; }
278
281 inline void setIncludeFlags(const unsigned short flags) { data.m_includeFlags = flags; }
282
286 inline unsigned short getExcludeFlags() const { return data.m_excludeFlags; }
287
290 inline void setExcludeFlags(const unsigned short flags) { data.m_excludeFlags = flags; }
291
293
295 inline bool equals(const dtQueryFilter* other) const { return data.equals(&(other->data)); }
296 inline bool equals(const dtQueryFilter& other) const { return data.equals(&(other.data)); }
297
299 inline void copyFrom(const dtQueryFilter* other) { data.copyFrom(&(other->data)); }
300 inline void copyFrom(const dtQueryFilter& other) { data.copyFrom(&(other.data)); }
301
302};
303
314
316{
317 inline void reserve(int n) { data.resize(n); data.resize(0); }
318 inline int size() const { return data.size(); }
319
320 inline dtPolyRef getRef(int idx) const { return data[idx].ref; }
321 inline dtReal getCost(int idx) const { return data[idx].cost; }
322 inline const dtReal* getPos(int idx) const { return data[idx].pos; }
323 inline unsigned int getFlag(int idx) const { return data[idx].flag; }
324 NAVMESH_API void getPos(int idx, dtReal* pos);
325
328 NAVMESH_API void copyPos(dtReal* pos, int nmax);
329 NAVMESH_API void copyFlags(unsigned char* flags, int nmax);
330 NAVMESH_API void copyFlags(unsigned int* flags, int nmax);
331
332protected:
334
335 inline int addItem(dtPolyRef ref, dtReal cost, const dtReal* pos, unsigned int flag) { data.push(dtQueryResultPack(ref, cost, pos, flag)); return data.size() - 1; }
336
337 inline void setRef(int idx, dtPolyRef ref) { data[idx].ref = ref; }
338 inline void setCost(int idx, dtReal cost) { data[idx].cost = cost; }
339 inline void setFlag(int idx, unsigned int flag) { data[idx].flag = flag; }
340 NAVMESH_API void setPos(int idx, const dtReal* pos);
341
342 friend class dtNavMeshQuery;
343};
344
349{
350public:
353
359 NAVMESH_API dtStatus init(const dtNavMesh* nav, const int maxNodes, dtQuerySpecialLinkFilter* linkFilter = 0);
360
363
365 // /@{
366
377 const dtReal* startPos, const dtReal* endPos, const dtReal costLimit, //@UE
378 const dtQueryFilter* filter,
379 dtQueryResult& result, dtReal* totalCost) const;
380
389 NAVMESH_API dtStatus findStraightPath(const dtReal* startPos, const dtReal* endPos,
390 const dtPolyRef* path, const int pathSize,
391 dtQueryResult& result, const int options = 0) const;
392
400
411 const dtReal* startPos, const dtReal* endPos, const dtReal costLimit, const bool requireNavigableEndLocation, //@UE
412 const dtQueryFilter* filter);
413
419
427
438 dtPolyRef* path, int* pathCount, const int maxPath);
439
443
457 const dtQueryFilter* filter,
459 int* resultCount, const int maxResult) const;
460
474 NAVMESH_API dtStatus findPolysAroundShape(dtPolyRef startRef, const dtReal* verts, const int nverts,
475 const dtQueryFilter* filter,
477 int* resultCount, const int maxResult) const;
478
479 //@UE BEGIN
490 const dtQueryFilter* filter, dtPolyRef* resultRef,
491 int* resultCount, const int maxResult) const;
492
496
506 const dtQueryFilter* filter,
508
519 const dtQueryFilter* filter,
521 const dtReal* referencePt = 0, dtReal tolerance = 0) const;
522
531 const dtQueryFilter* filter,
533 //@UE END
534
544 const dtQueryFilter* filter,
545 dtPolyRef* polys, int* polyCount, const int maxPolys) const;
546
559 const dtQueryFilter* filter,
561 int* resultCount, const int maxResult) const;
562
565 const dtQueryFilter* filter,
566 dtPolyRef* neiRefs, int* neiCount, const int maxNei,
567 dtReal* resultWalls, dtPolyRef* resultRefs, int* resultCount, const int maxResult) const;
568
569
571 NAVMESH_API dtStatus findWallsOverlappingShape(dtPolyRef startRef, const dtReal* verts, const int nverts,
572 const dtQueryFilter* filter,
573 dtPolyRef* neiRefs, int* neiCount, const int maxNei,
574 dtReal* resultWalls, dtPolyRef* resultRefs, int* resultCount, const int maxResult) const;
575
578 const dtReal maxAreaEnterCost, const dtQueryFilter* filter,
579 dtPolyRef* neiRefs, int* neiCount, const int maxNei,
580 dtReal* resultWalls, dtPolyRef* resultRefs, int* resultCount, const int maxResult) const;
581
592 NAVMESH_API dtStatus moveAlongSurface(dtPolyRef startRef, const dtReal* startPos, const dtReal* endPos,
593 const dtQueryFilter* filter,
594 dtReal* resultPos, dtPolyRef* visited, int* visitedCount, const int maxVisitedSize) const;
595
610 NAVMESH_API dtStatus raycast(dtPolyRef startRef, const dtReal* startPos, const dtReal* endPos,
611 const dtQueryFilter* filter,
612 dtReal* t, dtReal* hitNormal, dtPolyRef* path, int* pathCount, const int maxPath) const;
613
625 const dtQueryFilter* filter,
627
639 const int maxSegments) const;
640
648 NAVMESH_API dtStatus findRandomPoint(const dtQueryFilter* filter, float(*frand)(),
650
662 const dtQueryFilter* filter, float(*frand)(),
664
671
672 //@UE BEGIN
673#if WITH_NAVMESH_CLUSTER_LINKS
678 NAVMESH_API dtStatus testClusterPath(dtPolyRef startRef, dtPolyRef endRef) const;
679
687
693#endif // WITH_NAVMESH_CLUSTER_LINKS
694//@UE END
695
702
710
717
723 NAVMESH_API dtStatus isPointInsidePoly(dtPolyRef ref, const dtReal* pos, bool& result) const;
724
730 NAVMESH_API dtStatus getPolyHeight(dtPolyRef ref, const dtReal* pos, dtReal* height) const;
731
735
739 NAVMESH_API bool isValidPolyRef(dtPolyRef ref, const dtQueryFilter* filter) const;
740
744 NAVMESH_API bool isInClosedList(dtPolyRef ref) const;
745
751
754 class dtNodePool* getNodePool() const { return m_nodePool; }
755
758 const dtNavMesh* getAttachedNavMesh() const { return m_nav; }
759
761 void getCurrentBestResult(struct dtNode*& bestNode, dtReal& bestCost) const { bestNode = m_query.lastBestNode; bestCost = m_query.lastBestNodeCost; }
762
763 int getQueryNodes() const { return m_queryNodes; }
765
766private:
767
769 NAVMESH_API dtMeshTile* getNeighbourTileAt(int x, int y, int side) const;
770
772 NAVMESH_API int queryPolygonsInTile(const dtMeshTile* tile, const dtReal* qmin, const dtReal* qmax, const dtQueryFilter* filter,
773 dtPolyRef* polys, const int maxPolys) const;
775 NAVMESH_API dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const dtReal* center, const dtReal* extents,
776 const dtQueryFilter* filter, dtReal* nearestPt) const;
778 NAVMESH_API void closestPointOnPolyInTile(const dtMeshTile* tile, const dtPoly* poly, const dtReal* pos, dtReal* closest) const;
779
781 NAVMESH_API dtStatus projectedPointOnPolyInTile(const dtMeshTile* tile, const dtPoly* poly, const dtReal* pos, dtReal* projected) const;
782
783 //@UE BEGIN
785 static void dtApplyEpsilon(dtReal* extents);
786
787 // exposing function to be able to generate navigation corridors as sequence of point pairs
788public:
791 unsigned char& fromType, unsigned char& toType) const;
793 dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
794 dtReal* left, dtReal* right) const;
795
799 dtPolyRef to, const dtPoly* toPoly, const dtMeshTile* toTile,
800 dtReal* mid) const;
801 //@UE END
802
803 // Appends vertex to a straight path
804 NAVMESH_API dtStatus appendVertex(const dtReal* pos, const unsigned char flags, const dtPolyRef ref,
805 dtQueryResult& result, const bool bOverrideIdenticalPosition = true) const;
806
807 // Appends intermediate portal points to a straight path.
808 NAVMESH_API dtStatus appendPortals(const int startIdx, const int endIdx, const dtReal* endPos, const dtPolyRef* path,
809 dtQueryResult& result, const int options) const;
810
811 inline bool passLinkFilterByRef(const dtMeshTile* tile, const dtPolyRef ref) const
812 {
813 return passLinkFilter(tile, m_nav->decodePolyIdPoly(ref));
814 }
815
816 inline bool passLinkFilter(const dtMeshTile* tile, const int polyIdx) const
817 {
818 const int linkIdx = polyIdx - tile->header->offMeshBase;
819
820 return !(m_linkFilter && polyIdx >= tile->header->offMeshBase
821 && linkIdx < tile->header->offMeshConCount
822 && tile->offMeshCons[linkIdx].userId != 0
823 && m_linkFilter->isLinkAllowed(tile->offMeshCons[linkIdx].userId) == false);
824 }
825
826 //@UE BEGIN
827 inline void setRequireNavigableEndLocation(const bool value) { m_query.requireNavigableEndLocation = value; }
828 inline bool isRequiringNavigableEndLocation() const { return m_query.requireNavigableEndLocation; }
829 //@UE END
830
831private:
832 const dtNavMesh* m_nav;
833 dtQuerySpecialLinkFilter* m_linkFilter;
834
835 struct dtQueryData
836 {
837 dtStatus status;
838 struct dtNode* lastBestNode;
839 dtReal lastBestNodeCost;
840 dtPolyRef startRef, endRef;
841 dtReal startPos[3], endPos[3];
842 dtReal costLimit; //@UE ///< Cost limit of nodes allowed to be added to the open list
843 const dtQueryFilter* filter;
844 unsigned char requireNavigableEndLocation : 1; //@UE
845 };
846 dtQueryData m_query;
847
848 class dtNodePool* m_tinyNodePool;
849 class dtNodePool* m_nodePool;
850 class dtNodeQueue* m_openList;
851
852 mutable int m_queryNodes;
853};
854
859
864
865#endif // DETOURNAVMESHQUERY_H
#define check(expr)
Definition AssertionMacros.h:314
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
T dtMin(T a, T b)
Definition DetourCommon.h:54
dtReal dtVdist(const dtReal *v1, const dtReal *v2)
Definition DetourCommon.h:304
double dtReal
Definition DetourLargeWorldCoordinates.h:15
#define DT_UNWALKABLE_POLY_COST
Definition DetourNavMeshQuery.h:37
#define WITH_FIXED_AREA_ENTERING_COST
Definition DetourNavMeshQuery.h:34
UEType_uint64 dtClusterRef
A handle to a cluster within a navigation mesh tile.
Definition DetourNavMesh.h:63
unsigned int dtStatus
Definition RecastGraphAStar.h:29
uint64 dtPolyRef
Definition RecastGraphAStar.h:28
bool left(const int *a, const int *b, const int *c)
Definition RecastMesh.cpp:182
const char * source
Definition lz4.h:711
A simple dynamic array of integers.
Definition DetourAlloc.h:168
int size() const
The current size of the integer array.
Definition DetourAlloc.h:207
void push(T item)
Definition DetourAlloc.h:190
void resize(int n)
Definition DetourAlloc.h:211
Definition DetourNavMeshQuery.h:349
NAVMESH_API dtStatus finalizeSlicedFindPathPartial(const dtPolyRef *existing, const int existingSize, dtPolyRef *path, int *pathCount, const int maxPath)
Definition DetourNavMeshQuery.cpp:2347
NAVMESH_API dtStatus findRandomPoint(const dtQueryFilter *filter, float(*frand)(), dtPolyRef *randomRef, dtReal *randomPt) const
Definition DetourNavMeshQuery.cpp:311
NAVMESH_API dtStatus closestPointOnPoly(dtPolyRef ref, const dtReal *pos, dtReal *closest) const
Definition DetourNavMeshQuery.cpp:749
NAVMESH_API dtStatus raycast(dtPolyRef startRef, const dtReal *startPos, const dtReal *endPos, const dtQueryFilter *filter, dtReal *t, dtReal *hitNormal, dtPolyRef *path, int *pathCount, const int maxPath) const
Definition DetourNavMeshQuery.cpp:3317
void setRequireNavigableEndLocation(const bool value)
Definition DetourNavMeshQuery.h:827
NAVMESH_API dtStatus appendVertex(const dtReal *pos, const unsigned char flags, const dtPolyRef ref, dtQueryResult &result, const bool bOverrideIdenticalPosition=true) const
Definition DetourNavMeshQuery.cpp:2427
NAVMESH_API ~dtNavMeshQuery()
Definition DetourNavMeshQuery.cpp:218
NAVMESH_API dtStatus findPolysAroundCircle(dtPolyRef startRef, const dtReal *centerPos, const dtReal radius, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, dtReal *resultCost, int *resultCount, const int maxResult) const
Definition DetourNavMeshQuery.cpp:3574
NAVMESH_API dtStatus init(const dtNavMesh *nav, const int maxNodes, dtQuerySpecialLinkFilter *linkFilter=0)
Definition DetourNavMeshQuery.cpp:237
NAVMESH_API bool wasClusterLinkSearched(dtPolyRef cFrom, dtPolyRef cTo) const
bool isRequiringNavigableEndLocation() const
Definition DetourNavMeshQuery.h:828
bool passLinkFilter(const dtMeshTile *tile, const int polyIdx) const
Definition DetourNavMeshQuery.h:816
NAVMESH_API dtStatus initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef, const dtReal *startPos, const dtReal *endPos, const dtReal costLimit, const bool requireNavigableEndLocation, const dtQueryFilter *filter)
Definition DetourNavMeshQuery.cpp:2021
NAVMESH_API dtStatus findNearestPoly2D(const dtReal *center, const dtReal *extents, const dtQueryFilter *filter, dtPolyRef *outProjectedRef, dtReal *outProjectedPt, const dtReal *referencePt=0, dtReal tolerance=0) const
Definition DetourNavMeshQuery.cpp:1204
NAVMESH_API dtStatus findWallsAroundPath(const dtPolyRef *path, const int pathCount, const dtReal *searchAreaPoly, const int searchAreaPolyCount, const dtReal maxAreaEnterCost, const dtQueryFilter *filter, dtPolyRef *neiRefs, int *neiCount, const int maxNei, dtReal *resultWalls, dtPolyRef *resultRefs, int *resultCount, const int maxResult) const
[UE] Finds the wall segments that overlap the polygon shape.
Definition DetourNavMeshQuery.cpp:4952
NAVMESH_API dtStatus findPolysAroundShape(dtPolyRef startRef, const dtReal *verts, const int nverts, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, dtReal *resultCost, int *resultCount, const int maxResult) const
Definition DetourNavMeshQuery.cpp:3760
NAVMESH_API dtStatus getPolyHeight(dtPolyRef ref, const dtReal *pos, dtReal *height) const
Definition DetourNavMeshQuery.cpp:1028
void getCurrentBestResult(struct dtNode *&bestNode, dtReal &bestCost) const
Gets best node ref and cost from sliced pathfinding data.
Definition DetourNavMeshQuery.h:761
NAVMESH_API void updateLinkFilter(dtQuerySpecialLinkFilter *linkFilter)
UE: updates special link filter for this query.
Definition DetourNavMeshQuery.cpp:301
NAVMESH_API dtStatus queryPolygons(const dtReal *center, const dtReal *extents, const dtQueryFilter *filter, dtPolyRef *polys, int *polyCount, const int maxPolys) const
Definition DetourNavMeshQuery.cpp:1525
NAVMESH_API dtStatus findNearestContainingPoly(const dtReal *center, const dtReal *extents, const dtQueryFilter *filter, dtPolyRef *nearestRef, dtReal *nearestPt) const
Definition DetourNavMeshQuery.cpp:1306
NAVMESH_API dtStatus closestPointOnPolyBoundary(dtPolyRef ref, const dtReal *pos, dtReal *closest) const
Definition DetourNavMeshQuery.cpp:870
NAVMESH_API dtStatus isPointInsidePoly(dtPolyRef ref, const dtReal *pos, bool &result) const
Definition DetourNavMeshQuery.cpp:944
NAVMESH_API dtStatus getPortalPoints(dtPolyRef from, dtPolyRef to, dtReal *left, dtReal *right, unsigned char &fromType, unsigned char &toType) const
Returns portal points between two polygons.
Definition DetourNavMeshQuery.cpp:3099
NAVMESH_API dtStatus getPolyWallSegments(dtPolyRef ref, const dtQueryFilter *filter, dtReal *segmentVerts, dtPolyRef *segmentRefs, int *segmentCount, const int maxSegments) const
Definition DetourNavMeshQuery.cpp:4337
NAVMESH_API dtStatus findNearestPoly(const dtReal *center, const dtReal *extents, const dtQueryFilter *filter, dtPolyRef *nearestRef, dtReal *nearestPt, const dtReal *referencePt=0) const
Definition DetourNavMeshQuery.cpp:1139
NAVMESH_API dtStatus getEdgeMidPoint(dtPolyRef from, dtPolyRef to, dtReal *mid) const
Returns edge mid point between two polygons.
Definition DetourNavMeshQuery.cpp:3254
int getQueryNodes() const
Definition DetourNavMeshQuery.h:763
NAVMESH_API dtStatus findPolysInPathDistance(dtPolyRef startRef, const dtReal *centerPos, const dtReal pathDistance, const dtQueryFilter *filter, dtPolyRef *resultRef, int *resultCount, const int maxResult) const
Definition DetourNavMeshQuery.cpp:3926
NAVMESH_API dtStatus finalizeSlicedFindPath(dtPolyRef *path, int *pathCount, const int maxPath)
Definition DetourNavMeshQuery.cpp:2284
NAVMESH_API dtStatus updateSlicedFindPath(const int maxIter, int *doneIters)
Definition DetourNavMeshQuery.cpp:2077
NAVMESH_API dtStatus findLocalNeighbourhood(dtPolyRef startRef, const dtReal *centerPos, const dtReal radius, const dtQueryFilter *filter, dtPolyRef *resultRef, dtPolyRef *resultParent, int *resultCount, const int maxResult) const
Definition DetourNavMeshQuery.cpp:4113
NAVMESH_API dtStatus findWallsInNeighbourhood(dtPolyRef startRef, const dtReal *centerPos, const dtReal radius, const dtQueryFilter *filter, dtPolyRef *neiRefs, int *neiCount, const int maxNei, dtReal *resultWalls, dtPolyRef *resultRefs, int *resultCount, const int maxResult) const
[UE] Finds the wall segments in local neighbourhood
Definition DetourNavMeshQuery.cpp:4611
NAVMESH_API dtNavMeshQuery()
Definition DetourNavMeshQuery.cpp:207
NAVMESH_API dtStatus findDistanceToWall(dtPolyRef startRef, const dtReal *centerPos, const dtReal maxRadius, const dtQueryFilter *filter, dtReal *hitDist, dtReal *hitPos, dtReal *hitNormal) const
Definition DetourNavMeshQuery.cpp:5142
NAVMESH_API dtStatus moveAlongSurface(dtPolyRef startRef, const dtReal *startPos, const dtReal *endPos, const dtQueryFilter *filter, dtReal *resultPos, dtPolyRef *visited, int *visitedCount, const int maxVisitedSize) const
Definition DetourNavMeshQuery.cpp:2892
const dtNavMesh * getAttachedNavMesh() const
Definition DetourNavMeshQuery.h:758
bool passLinkFilterByRef(const dtMeshTile *tile, const dtPolyRef ref) const
Definition DetourNavMeshQuery.h:811
NAVMESH_API dtStatus projectedPointOnPoly(dtPolyRef ref, const dtReal *pos, dtReal *projected) const
Definition DetourNavMeshQuery.cpp:931
NAVMESH_API dtStatus appendPortals(const int startIdx, const int endIdx, const dtReal *endPos, const dtPolyRef *path, dtQueryResult &result, const int options) const
Definition DetourNavMeshQuery.cpp:2448
class dtNodePool * getNodePool() const
Definition DetourNavMeshQuery.h:754
NAVMESH_API bool isValidPolyRef(dtPolyRef ref, const dtQueryFilter *filter) const
Definition DetourNavMeshQuery.cpp:5374
NAVMESH_API dtStatus findPath(dtPolyRef startRef, dtPolyRef endRef, const dtReal *startPos, const dtReal *endPos, const dtReal costLimit, const dtQueryFilter *filter, dtQueryResult &result, dtReal *totalCost) const
Definition DetourNavMeshQuery.cpp:1578
NAVMESH_API bool isInClosedList(dtPolyRef ref) const
Definition DetourNavMeshQuery.cpp:5391
NAVMESH_API dtStatus findRandomPointInPoly(dtPolyRef ref, float(*frand)(), dtReal *randomPt) const
Definition DetourNavMeshQuery.cpp:607
NAVMESH_API dtStatus findStraightPath(const dtReal *startPos, const dtReal *endPos, const dtPolyRef *path, const int pathSize, dtQueryResult &result, const int options=0) const
Definition DetourNavMeshQuery.cpp:2538
NAVMESH_API dtStatus findWallsOverlappingShape(dtPolyRef startRef, const dtReal *verts, const int nverts, const dtQueryFilter *filter, dtPolyRef *neiRefs, int *neiCount, const int maxNei, dtReal *resultWalls, dtPolyRef *resultRefs, int *resultCount, const int maxResult) const
[UE] Finds the wall segments that overlap the polygon shape.
Definition DetourNavMeshQuery.cpp:4785
NAVMESH_API dtStatus findRandomPointAroundCircle(dtPolyRef startRef, const dtReal *centerPos, const dtReal maxRadius, const dtQueryFilter *filter, float(*frand)(), dtPolyRef *randomRef, dtReal *randomPt) const
Definition DetourNavMeshQuery.cpp:404
Definition DetourNavMesh.h:503
unsigned int decodePolyIdPoly(dtPolyRef ref) const
Definition DetourNavMesh.h:793
Definition DetourNode.h:50
Definition DetourNode.h:117
Definition DetourNavMeshQuery.h:96
void setAreaCost(const int i, const dtReal cost)
Definition DetourNavMeshQuery.h:222
void setExcludeFlags(const unsigned short flags)
Definition DetourNavMeshQuery.h:290
void setShouldIgnoreClosedNodes(const bool shouldIgnore)
Instruct filter whether it can reopen nodes already on closed list.
Definition DetourNavMeshQuery.h:267
virtual ~dtQueryFilter()
Definition DetourNavMeshQuery.h:104
bool isVirtual
Definition DetourNavMeshQuery.h:99
virtual dtReal getVirtualCost(const dtReal *pa, const dtReal *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const
virtual scoring function implementation (defaults to getInlineCost).
Definition DetourNavMeshQuery.h:163
dtQueryFilterData data
Definition DetourNavMeshQuery.h:98
const dtReal * getAllAreaCosts() const
Definition DetourNavMeshQuery.h:225
dtReal getCost(const dtReal *pa, const dtReal *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const
Definition DetourNavMeshQuery.h:202
dtQueryFilter(bool inIsVirtual=true)
Definition DetourNavMeshQuery.h:102
bool isValidLinkSide(const unsigned char side) const
Definition DetourNavMeshQuery.h:252
void setHeuristicScale(const dtReal newScale)
Set euclidean distance heuristic scale.
Definition DetourNavMeshQuery.h:248
unsigned short getIncludeFlags() const
Definition DetourNavMeshQuery.h:277
bool getShouldIgnoreClosedNodes() const
Definition DetourNavMeshQuery.h:271
const dtReal * getAllFixedAreaCosts() const
Definition DetourNavMeshQuery.h:238
void setIsBacktracking(const bool isBacktracking)
Sets up filter for backtracking.
Definition DetourNavMeshQuery.h:260
dtReal getInlineCost(const dtReal *pa, const dtReal *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const
inlined scoring function.
Definition DetourNavMeshQuery.h:147
bool getIsVirtual() const
Returns true if it's a virtual filter.
Definition DetourNavMeshQuery.h:131
virtual bool passVirtualFilter(const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const
virtual filter implementation (defaults to passInlineFilter).
Definition DetourNavMeshQuery.h:122
virtual float getVirtualCost(const float *pa, const float *pb, const dtPolyRef prevRef, const dtMeshTile *prevTile, const dtPoly *prevPoly, const dtPolyRef curRef, const dtMeshTile *curTile, const dtPoly *curPoly, const dtPolyRef nextRef, const dtMeshTile *nextTile, const dtPoly *nextPoly) const final
Definition DetourNavMeshQuery.h:177
bool passFilter(const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const
Definition DetourNavMeshQuery.h:137
dtReal getAreaFixedCost(const int i) const
Definition DetourNavMeshQuery.h:231
void setIncludeFlags(const unsigned short flags)
Definition DetourNavMeshQuery.h:281
unsigned short getExcludeFlags() const
Definition DetourNavMeshQuery.h:286
void setAreaFixedCost(const int i, const dtReal cost)
Definition DetourNavMeshQuery.h:236
void copyFrom(const dtQueryFilter *other)
Copy data values from source filter.
Definition DetourNavMeshQuery.h:299
bool equals(const dtQueryFilter *other) const
Check if two filters have the same data values.
Definition DetourNavMeshQuery.h:295
bool getIsBacktracking() const
Definition DetourNavMeshQuery.h:264
dtReal getModifiedHeuristicScale() const
Definition DetourNavMeshQuery.h:241
bool equals(const dtQueryFilter &other) const
Definition DetourNavMeshQuery.h:296
dtReal getAreaCost(const int i) const
Definition DetourNavMeshQuery.h:217
bool passInlineFilter(const dtPolyRef ref, const dtMeshTile *tile, const dtPoly *poly) const
inlined filter implementation.
Definition DetourNavMeshQuery.h:109
dtReal getHeuristicScale() const
Definition DetourNavMeshQuery.h:245
void copyFrom(const dtQueryFilter &other)
Definition DetourNavMeshQuery.h:300
NAVMESH_API void dtFreeNavMeshQuery(dtNavMeshQuery *query)
Definition DetourNavMeshQuery.cpp:118
NAVMESH_API dtNavMeshQuery * dtAllocNavMeshQuery()
Definition DetourNavMeshQuery.cpp:111
Definition DetourNavMesh.h:422
Definition DetourNode.h:39
Definition DetourNavMesh.h:206
unsigned short flags
The user defined polygon flags.
Definition DetourNavMesh.h:218
unsigned char getArea() const
Gets the user defined area id.
Definition DetourNavMesh.h:234
Definition DetourNavMeshQuery.h:67
NAVMESH_API dtQueryFilterData()
Definition DetourNavMeshQuery.cpp:70
dtReal m_areaFixedCost[DT_MAX_AREAS]
Fixed cost for entering an area type (Used by default implementation.)
Definition DetourNavMeshQuery.h:70
bool m_isBacktracking
Definition DetourNavMeshQuery.h:78
dtReal lowestAreaCost
Definition DetourNavMeshQuery.h:73
unsigned short m_includeFlags
Flags for polygons that can be visited. (Used by default implementation.)
Definition DetourNavMeshQuery.h:75
NAVMESH_API bool equals(const dtQueryFilterData *other) const
Definition DetourNavMeshQuery.cpp:83
dtReal m_areaCost[DT_MAX_AREAS]
Cost per area type. (Used by default implementation.)
Definition DetourNavMeshQuery.h:68
bool m_shouldIgnoreClosedNodes
Definition DetourNavMeshQuery.h:84
NAVMESH_API void copyFrom(const dtQueryFilterData *source)
Definition DetourNavMeshQuery.cpp:102
dtReal heuristicScale
Search heuristic scale.
Definition DetourNavMeshQuery.h:72
unsigned short m_excludeFlags
Flags for polygons that should not be visited. (Used by default implementation.)
Definition DetourNavMeshQuery.h:76
Definition DetourNavMeshQuery.h:305
dtPolyRef ref
Definition DetourNavMeshQuery.h:306
dtReal pos[3]
Definition DetourNavMeshQuery.h:308
dtQueryResultPack()
Definition DetourNavMeshQuery.h:311
unsigned int flag
Definition DetourNavMeshQuery.h:309
dtReal cost
Definition DetourNavMeshQuery.h:307
Definition DetourNavMeshQuery.h:316
dtReal getCost(int idx) const
Definition DetourNavMeshQuery.h:321
int addItem(dtPolyRef ref, dtReal cost, const dtReal *pos, unsigned int flag)
Definition DetourNavMeshQuery.h:335
void reserve(int n)
Definition DetourNavMeshQuery.h:317
void setFlag(int idx, unsigned int flag)
Definition DetourNavMeshQuery.h:339
dtChunkArray< dtQueryResultPack > data
Definition DetourNavMeshQuery.h:333
NAVMESH_API void copyFlags(unsigned char *flags, int nmax)
Definition DetourNavMeshQuery.cpp:171
unsigned int getFlag(int idx) const
Definition DetourNavMeshQuery.h:323
const dtReal * getPos(int idx) const
Definition DetourNavMeshQuery.h:322
int size() const
Definition DetourNavMeshQuery.h:318
dtPolyRef getRef(int idx) const
Definition DetourNavMeshQuery.h:320
NAVMESH_API void setPos(int idx, const dtReal *pos)
Definition DetourNavMeshQuery.cpp:139
NAVMESH_API void copyPos(dtReal *pos, int nmax)
Definition DetourNavMeshQuery.cpp:162
NAVMESH_API void copyCosts(dtReal *costs, int nmax)
Definition DetourNavMeshQuery.cpp:153
void setCost(int idx, dtReal cost)
Definition DetourNavMeshQuery.h:338
void setRef(int idx, dtPolyRef ref)
Definition DetourNavMeshQuery.h:337
NAVMESH_API void copyRefs(dtPolyRef *refs, int nmax)
Definition DetourNavMeshQuery.cpp:144
Definition DetourNavMeshQuery.h:50
virtual void initialize()
Called before accessing in A* loop (can be called multiple time for updateSlicedFindPath)
Definition DetourNavMeshQuery.h:62
virtual bool isLinkAllowed(const unsigned long long int UserId) const
Definition DetourNavMeshQuery.h:56
virtual ~dtQuerySpecialLinkFilter()
Definition DetourNavMeshQuery.h:51