UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DetourPathCorridor.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 DETOUTPATHCORRIDOR_H
23#define DETOUTPATHCORRIDOR_H
24
25#include "CoreMinimal.h"
28#include "HAL/Platform.h"
29
30class dtNavMeshQuery;
31class dtQueryFilter;
32
36{
37 dtReal m_pos[3];
38 dtReal m_target[3];
39 dtReal m_prevMovePoint[3];
40 dtReal m_nextExpectedCorner[3];
41 dtReal m_nextExpectedCorner2[3];
42 dtReal m_moveSegAngle;
43 uint32 m_hasNextExpectedCorner : 1;
44 uint32 m_hasNextExpectedCorner2 : 1;
45 uint32 m_isInSkipRange : 1;
46 uint32 m_enableEarlyReach : 1;
47
48 dtPolyRef* m_path;
49 int m_npath;
50 int m_maxPath;
51
52public:
55
59 NAVMESH_API bool init(const int maxPath);
60
64 NAVMESH_API void reset(dtPolyRef ref, const dtReal* pos);
65
78 NAVMESH_API int findCorners(dtReal* cornerVerts, unsigned char* cornerFlags,
79 dtPolyRef* cornerPolys, const int maxCorners,
82
88 NAVMESH_API bool optimizePathVisibility(const dtReal* next, const dtReal pathOptimizationRange,
89 dtNavMeshQuery* navquery, const dtQueryFilter* filter);
90
95
97 const dtReal* agentPos,
98 dtReal* startPos, dtReal* endPos,
100
103 const dtReal* agentPos, dtReal* startPos, dtReal* endPos,
104 dtNavMeshQuery* navquery) const;
105
108
110
112 dtNavMeshQuery* navquery, const dtQueryFilter* filter);
113
118 NAVMESH_API bool isValid(const int maxLookAhead, dtNavMeshQuery* navquery, const dtQueryFilter* filter);
119
125 NAVMESH_API bool movePosition(const dtReal* npos, dtNavMeshQuery* navquery, const dtQueryFilter* filter);
126
133
138 NAVMESH_API void setCorridor(const dtReal* target, const dtPolyRef* polys, const int npath);
139
142 inline const dtReal* getPos() const { return m_pos; }
143
146 inline const dtReal* getTarget() const { return m_target; }
147
150 inline dtPolyRef getFirstPoly() const { return m_npath ? m_path[0] : 0; }
151
154 inline dtPolyRef getLastPoly() const { return m_npath ? m_path[m_npath-1] : 0; }
155
158 inline const dtPolyRef* getPath() const { return m_path; }
159
162 inline int getPathCount() const { return m_npath; }
163
164 inline void setEarlyReachTest(bool enable) { m_enableEarlyReach = enable; }
165
166 inline dtReal getSegmentAngle() const { return m_moveSegAngle; }
167 inline const dtReal* getNextFixedCorner() const { return &m_nextExpectedCorner[0]; }
168 inline const dtReal* getNextFixedCorner2() const { return &m_nextExpectedCorner2[0]; }
169 inline bool hasNextFixedCorner() const { return m_hasNextExpectedCorner; }
170 inline bool hasNextFixedCorner2() const { return m_hasNextExpectedCorner2; }
171};
172
173int dtMergeCorridorStartMoved(dtPolyRef* path, const int npath, const int maxPath,
174 const dtPolyRef* visited, const int nvisited);
175
176int dtMergeCorridorEndMoved(dtPolyRef* path, const int npath, const int maxPath,
177 const dtPolyRef* visited, const int nvisited);
178
179int dtMergeCorridorStartShortcut(dtPolyRef* path, const int npath, const int maxPath,
180 const dtPolyRef* visited, const int nvisited);
181
182#endif // DETOUTPATHCORRIDOR_H
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
double dtReal
Definition DetourLargeWorldCoordinates.h:15
int dtMergeCorridorStartShortcut(dtPolyRef *path, const int npath, const int maxPath, const dtPolyRef *visited, const int nvisited)
Definition DetourPathCorridor.cpp:110
int dtMergeCorridorEndMoved(dtPolyRef *path, const int npath, const int maxPath, const dtPolyRef *visited, const int nvisited)
Definition DetourPathCorridor.cpp:72
int dtMergeCorridorStartMoved(dtPolyRef *path, const int npath, const int maxPath, const dtPolyRef *visited, const int nvisited)
Definition DetourPathCorridor.cpp:27
uint64 dtPolyRef
Definition RecastGraphAStar.h:28
int next(int i, int n)
Definition RecastMesh.cpp:164
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition DetourNavMeshQuery.h:349
Definition DetourPathCorridor.h:36
NAVMESH_API bool trimInvalidPath(dtPolyRef safeRef, const dtReal *safePos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:769
NAVMESH_API void setCorridor(const dtReal *target, const dtPolyRef *polys, const int npath)
Definition DetourPathCorridor.cpp:734
NAVMESH_API ~dtPathCorridor()
Definition DetourPathCorridor.cpp:208
dtPolyRef getFirstPoly() const
Definition DetourPathCorridor.h:150
dtReal getSegmentAngle() const
Definition DetourPathCorridor.h:166
NAVMESH_API void pruneOffmeshConenction(dtPolyRef offMeshConRef)
[UE] remove offmesh connection from corridor
Definition DetourPathCorridor.cpp:624
int getPathCount() const
Definition DetourPathCorridor.h:162
NAVMESH_API bool moveOverOffmeshConnection(dtPolyRef offMeshConRef, dtPolyRef *refs, const dtReal *agentPos, dtReal *startPos, dtReal *endPos, dtNavMeshQuery *navquery)
Definition DetourPathCorridor.cpp:542
NAVMESH_API dtPathCorridor()
Definition DetourPathCorridor.cpp:200
dtPolyRef getLastPoly() const
Definition DetourPathCorridor.h:154
const dtReal * getNextFixedCorner2() const
Definition DetourPathCorridor.h:168
bool hasNextFixedCorner2() const
Definition DetourPathCorridor.h:170
NAVMESH_API void reset(dtPolyRef ref, const dtReal *pos)
Definition DetourPathCorridor.cpp:231
const dtReal * getPos() const
Definition DetourPathCorridor.h:142
NAVMESH_API bool optimizePathTopology(dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:513
NAVMESH_API bool canMoveOverOffmeshConnection(dtPolyRef offMeshConRef, dtPolyRef *refs, const dtReal *agentPos, dtReal *startPos, dtReal *endPos, dtNavMeshQuery *navquery) const
[UE] check if offmesh connection can be traversed, but don't modify corridor yet
Definition DetourPathCorridor.cpp:586
const dtPolyRef * getPath() const
Definition DetourPathCorridor.h:158
NAVMESH_API bool init(const int maxPath)
Definition DetourPathCorridor.cpp:216
NAVMESH_API bool movePosition(const dtReal *npos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:663
const dtReal * getNextFixedCorner() const
Definition DetourPathCorridor.h:167
bool hasNextFixedCorner() const
Definition DetourPathCorridor.h:169
NAVMESH_API bool optimizePathVisibility(const dtReal *next, const dtReal pathOptimizationRange, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:466
NAVMESH_API int findCorners(dtReal *cornerVerts, unsigned char *cornerFlags, dtPolyRef *cornerPolys, const int maxCorners, dtNavMeshQuery *navquery, const dtQueryFilter *filter, dtReal pathOffsetDistance, dtReal earlyReachDistance, bool bAllowEarlyReach=true)
Definition DetourPathCorridor.cpp:252
NAVMESH_API bool fixPathStart(dtPolyRef safeRef, const dtReal *safePos)
Definition DetourPathCorridor.cpp:748
NAVMESH_API void moveTargetPosition(const dtReal *npos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:705
void setEarlyReachTest(bool enable)
Definition DetourPathCorridor.h:164
NAVMESH_API bool isValid(const int maxLookAhead, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
Definition DetourPathCorridor.cpp:812
const dtReal * getTarget() const
Definition DetourPathCorridor.h:146
Definition DetourNavMeshQuery.h:96