25#include "Containers/Map.h"
44static const int DT_CROWDAGENT_MAX_NEIGHBOURS = 6;
51static const int DT_CROWDAGENT_MAX_CORNERS = 4;
58static const int DT_CROWD_MAX_OBSTAVOIDANCE_PARAMS = 8;
61static const int DT_CROWD_MAX_FILTERS = 16;
238 int m_numActiveAgents;
260 dtReal m_agentStateCheckInterval;
263 dtReal m_pathOffsetRadiusMultiplier;
266 dtReal m_separationDirFilter;
270 int m_velocitySampleCount;
275 bool m_raycastSingleArea;
277 bool m_keepOffmeshConnections;
279 bool m_earlyReachTest;
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
CrowdBoundaryFlags
Definition DetourCrowd.h:221
@ DT_CROWD_BOUNDARY_IGNORE
Definition DetourCrowd.h:222
MoveRequestState
Definition DetourCrowd.h:128
@ DT_CROWDAGENT_TARGET_WAITING_FOR_PATH
Definition DetourCrowd.h:134
@ DT_CROWDAGENT_TARGET_NONE
Definition DetourCrowd.h:129
@ DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE
Definition DetourCrowd.h:133
@ DT_CROWDAGENT_TARGET_VALID
Definition DetourCrowd.h:131
@ DT_CROWDAGENT_TARGET_REQUESTING
Definition DetourCrowd.h:132
@ DT_CROWDAGENT_TARGET_VELOCITY
Definition DetourCrowd.h:135
@ DT_CROWDAGENT_TARGET_FAILED
Definition DetourCrowd.h:130
double dtReal
Definition DetourLargeWorldCoordinates.h:15
unsigned int dtPathQueueRef
Definition DetourPathQueue.h:38
uint64 dtPolyRef
Definition RecastGraphAStar.h:28
Definition UnrealString.h.inl:34
Definition SharedPointer.h:692
Definition DetourCrowd.h:236
const dtCrowdAgentAnimation * getAgentAnims() const
Gets all agent animations.
Definition DetourCrowd.h:534
const dtProximityGrid * getGrid() const
Definition DetourCrowd.h:514
NAVMESH_API bool initAvoidance(const int maxNeighbors, const int maxWalls, const int maxCustomPatterns)
Definition DetourCrowd.cpp:458
NAVMESH_API bool resetAgentVelocity(const int idx)
Definition DetourCrowd.cpp:796
NAVMESH_API dtCrowd()
Definition DetourCrowd.cpp:331
int getVelocitySampleCount() const
Definition DetourCrowd.h:510
const dtSharedBoundary * getSharedBoundary() const
Gets shared boundary cache.
Definition DetourCrowd.h:524
NAVMESH_API void updateAgentState(const int idx, bool repath)
Definition DetourCrowd.cpp:635
NAVMESH_API void setSeparationFilter(dtReal InFilter)
[UE] Set separation filter param
Definition DetourCrowd.cpp:1877
NAVMESH_API bool setAgentCorridor(const int idx, const dtPolyRef *path, const int npath)
Definition DetourCrowd.cpp:1847
int getNumActiveAgents() const
Definition DetourCrowd.h:529
NAVMESH_API void updateAgentParameters(const int idx, const dtCrowdAgentParams ¶ms)
Definition DetourCrowd.cpp:522
NAVMESH_API const dtObstacleAvoidanceParams * getObstacleAvoidanceParams(const int idx) const
Definition DetourCrowd.cpp:492
NAVMESH_API void updateStepCorridor(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1666
NAVMESH_API void updateStepNextMovePoint(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1316
NAVMESH_API void updateStepPaths(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1235
NAVMESH_API void setPathOffsetRadiusMultiplier(dtReal RadiusMultiplier)
[UE] Set agent radius multiplier for offseting path from corners
Definition DetourCrowd.cpp:1882
NAVMESH_API void setAgentCheckInterval(const dtReal t)
Definition DetourCrowd.cpp:1801
NAVMESH_API void updateStepSteering(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1432
NAVMESH_API void setEarlyReachTestOptimization(bool bEnable)
[UE]
Definition DetourCrowd.cpp:1816
NAVMESH_API bool resetMoveTarget(const int idx)
Definition DetourCrowd.cpp:751
NAVMESH_API bool requestMoveTarget(const int idx, dtPolyRef ref, const dtReal *pos)
Definition DetourCrowd.cpp:712
NAVMESH_API void update(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1219
NAVMESH_API void setObstacleAvoidancePattern(int idx, const dtReal *angles, const dtReal *radii, int nsamples)
Definition DetourCrowd.cpp:499
NAVMESH_API bool requestMoveVelocity(const int idx, const dtReal *vel)
Definition DetourCrowd.cpp:734
NAVMESH_API void setPruneStartedOffmeshConnections(bool bRemoveFromCorridor)
Definition DetourCrowd.cpp:1811
NAVMESH_API void setObstacleAvoidanceParams(const int idx, const dtObstacleAvoidanceParams *params)
Definition DetourCrowd.cpp:486
NAVMESH_API ~dtCrowd()
Definition DetourCrowd.cpp:352
NAVMESH_API const dtQueryFilter * getFilter(const int idx) const
Definition DetourCrowd.cpp:1865
NAVMESH_API void updateStepOffMeshVelocity(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1739
int getAgentIndex(const dtCrowdAgent *agent) const
Definition DetourCrowd.h:531
NAVMESH_API bool init(const int maxAgents, const dtReal maxAgentRadius, dtNavMesh *nav)
Definition DetourCrowd.cpp:388
NAVMESH_API void updateStepOffMeshAnim(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1691
NAVMESH_API void setSingleAreaVisibilityOptimization(bool bEnable)
Definition DetourCrowd.cpp:1806
const dtPathQueue * getPathQueue() const
Definition DetourCrowd.h:518
NAVMESH_API void updateStepAvoidance(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1533
NAVMESH_API const int getAgentCount() const
Definition DetourCrowd.cpp:509
const dtNavMeshQuery * getNavMeshQuery() const
Gets the query object used by the crowd.
Definition DetourCrowd.h:521
NAVMESH_API bool getObstacleAvoidancePattern(int idx, dtReal *angles, dtReal *radii, int *nsamples)
Definition DetourCrowd.cpp:504
NAVMESH_API bool isOutsideCorridor(const int idx) const
[UE] Check if agent moved away from its path corridor
Definition DetourCrowd.cpp:1821
const dtReal * getQueryExtents() const
Definition DetourCrowd.h:506
dtCrowdAgent ** getActiveAgents() const
Gets all cached active agents.
Definition DetourCrowd.h:527
NAVMESH_API int cacheActiveAgents()
Definition DetourCrowd.cpp:820
NAVMESH_API dtQueryFilter * getEditableFilter(const int idx)
Definition DetourCrowd.cpp:1871
NAVMESH_API bool setAgentBackOnLink(const int idx)
Definition DetourCrowd.cpp:779
NAVMESH_API bool updateAgentFilter(const int idx, const dtQueryFilter *filter)
Definition DetourCrowd.cpp:532
NAVMESH_API int addAgent(const dtReal *pos, const dtCrowdAgentParams ¶ms, const dtQueryFilter *filter)
Definition DetourCrowd.cpp:576
NAVMESH_API void updateStepProximityData(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1247
NAVMESH_API void removeAgent(const int idx)
Definition DetourCrowd.cpp:677
NAVMESH_API bool setAgentWaiting(const int idx)
Definition DetourCrowd.cpp:768
NAVMESH_API const dtCrowdAgent * getAgent(const int idx)
Definition DetourCrowd.cpp:517
NAVMESH_API void updateStepMove(const dtReal dt, dtCrowdAgentDebugInfo *debug)
Definition DetourCrowd.cpp:1587
Definition DetourLocalBoundary.h:34
Definition DetourNavMeshQuery.h:349
Definition DetourNavMesh.h:503
Definition DetourObstacleAvoidance.h:45
Definition DetourObstacleAvoidance.h:109
Definition DetourPathCorridor.h:36
Definition DetourPathQueue.h:41
Definition DetourProximityGrid.h:29
Definition DetourNavMeshQuery.h:96
Definition DetourSharedBoundary.h:37
NAVMESH_API dtCrowd * dtAllocCrowd()
Definition DetourCrowd.cpp:28
CrowdAgentState
Definition DetourCrowd.h:75
UpdateFlags
Definition DetourCrowd.h:208
NAVMESH_API void dtFreeCrowd(dtCrowd *ptr)
Definition DetourCrowd.cpp:35
@ DT_CROWDAGENT_STATE_OFFMESH
The agent is traversing an off-mesh connection.
Definition DetourCrowd.h:78
@ DT_CROWDAGENT_STATE_WALKING
The agent is traversing a normal navigation mesh polygon.
Definition DetourCrowd.h:77
@ DT_CROWDAGENT_STATE_INVALID
The agent is not in a valid state.
Definition DetourCrowd.h:76
@ DT_CROWDAGENT_STATE_WAITING
[UE] The agent is waiting for external movement to finish
Definition DetourCrowd.h:79
@ DT_CROWD_SEPARATION
Definition DetourCrowd.h:211
@ DT_CROWD_SLOWDOWN_AT_GOAL
[UE] Slowdown before reaching goal
Definition DetourCrowd.h:216
@ DT_CROWD_OFFSET_PATH
[UE] Offset path points from corners by agent radius
Definition DetourCrowd.h:215
@ DT_CROWD_OPTIMIZE_TOPO
Use dtPathCorridor::optimizePathTopology() to optimize the agent path.
Definition DetourCrowd.h:213
@ DT_CROWD_OPTIMIZE_VIS_MULTI
[UE] Multiple calls for optimizePathVisibility instead of checking last point
Definition DetourCrowd.h:214
@ DT_CROWD_OPTIMIZE_VIS
Use dtPathCorridor::optimizePathVisibility() to optimize the agent path.
Definition DetourCrowd.h:212
@ DT_CROWD_OBSTACLE_AVOIDANCE
Definition DetourCrowd.h:210
@ DT_CROWD_ANTICIPATE_TURNS
Definition DetourCrowd.h:209
Definition DetourCrowd.h:197
dtReal startPos[3]
Definition DetourCrowd.h:198
dtReal endPos[3]
Definition DetourCrowd.h:198
unsigned char active
Definition DetourCrowd.h:201
dtPolyRef polyRef
Definition DetourCrowd.h:199
dtReal t
Definition DetourCrowd.h:200
dtReal tmax
Definition DetourCrowd.h:200
dtReal initPos[3]
Definition DetourCrowd.h:198
Definition DetourCrowd.h:226
dtReal optStart[3]
Definition DetourCrowd.h:228
TMap< int32, FString > agentLog
Definition DetourCrowd.h:230
dtObstacleAvoidanceDebugData * vod
Definition DetourCrowd.h:229
dtReal optEnd[3]
Definition DetourCrowd.h:228
int idx
Definition DetourCrowd.h:227
Definition DetourCrowd.h:85
TSharedPtr< dtQuerySpecialLinkFilter > linkFilter
UE: special link filter used by this agent.
Definition DetourCrowd.h:90
dtReal maxAcceleration
Maximum allowed acceleration. [Limit: >= 0].
Definition DetourCrowd.h:94
void * userData
User defined data attached to the agent.
Definition DetourCrowd.h:87
dtReal maxSpeed
Maximum allowed speed. [Limit: >= 0].
Definition DetourCrowd.h:95
unsigned char filter
Definition DetourCrowd.h:124
dtReal collisionQueryRange
Defines how close a collision element must be before it is considered for steering behaviors....
Definition DetourCrowd.h:98
unsigned int groupsToIgnore
[UE] Don't avoid agents when they group is matching mask
Definition DetourCrowd.h:113
dtReal separationWeight
How aggresive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0].
Definition DetourCrowd.h:103
dtReal height
Agent height. [Limit: > 0].
Definition DetourCrowd.h:93
unsigned int groupsToAvoid
[UE] Avoid agents when they group is matching mask
Definition DetourCrowd.h:111
dtReal pathOptimizationRange
The path visibility optimization range. [Limit: > 0].
Definition DetourCrowd.h:100
dtReal avoidanceQueryMultiplier
[UE] Mutliplier for avoidance velocities
Definition DetourCrowd.h:106
dtReal radius
Agent radius. [Limit: >= 0].
Definition DetourCrowd.h:92
unsigned char obstacleAvoidanceType
Definition DetourCrowd.h:120
unsigned int avoidanceGroup
[UE] Groups flags attached to the agent
Definition DetourCrowd.h:109
unsigned short updateFlags
Flags that impact steering behavior. (See: UpdateFlags)
Definition DetourCrowd.h:116
Definition DetourCrowd.h:141
unsigned char state
The type of mesh polygon the agent is traversing. (See: CrowdAgentState)
Definition DetourCrowd.h:193
unsigned char cornerFlags[DT_CROWDAGENT_MAX_CORNERS]
The local path corridor corner flags. (See: dtStraightPathFlags) [(flags) * ncorners].
Definition DetourCrowd.h:181
dtReal cornerVerts[DT_CROWDAGENT_MAX_CORNERS *3]
The local path corridor corners for the agent. (Staight path.) [(x, y, z) * ncorners].
Definition DetourCrowd.h:167
dtPolyRef targetRef
Target polyref of the movement request.
Definition DetourCrowd.h:174
dtPathQueueRef targetPathqRef
Path finder ref.
Definition DetourCrowd.h:175
unsigned char targetState
State of the movement request.
Definition DetourCrowd.h:187
int nneis
The number of neighbors.
Definition DetourCrowd.h:178
dtReal topologyOptTime
Time since the agent's path corridor was optimized.
Definition DetourCrowd.h:149
dtReal vel[3]
The actual velocity of the agent. [(x, y, z)].
Definition DetourCrowd.h:161
dtReal targetReplanTime
Definition DetourCrowd.h:172
dtReal dvel[3]
The desired velocity of the agent. [(x, y, z)].
Definition DetourCrowd.h:159
dtReal disp[3]
Definition DetourCrowd.h:158
dtPathCorridor corridor
The path corridor the agent is using.
Definition DetourCrowd.h:143
dtLocalBoundary boundary
The local boundary data for the agent.
Definition DetourCrowd.h:146
dtReal npos[3]
The current agent position. [(x, y, z)].
Definition DetourCrowd.h:157
int ncorners
The number of corners.
Definition DetourCrowd.h:184
dtReal targetPos[3]
<Time since the agent's target was replanned.
Definition DetourCrowd.h:173
dtReal desiredSpeed
The desired speed.
Definition DetourCrowd.h:155
dtCrowdNeighbour neis[DT_CROWDAGENT_MAX_NEIGHBOURS]
The known neighbors of the agent.
Definition DetourCrowd.h:152
unsigned char targetReplan
Flag indicating that the current path is being replanned.
Definition DetourCrowd.h:186
dtPolyRef cornerPolys[DT_CROWDAGENT_MAX_CORNERS]
The reference id of the polygon being entered at the corner. [(polyRef) * ncorners].
Definition DetourCrowd.h:170
unsigned char active
1 if the agent is active, or 0 if the agent is in an unused slot in the agent pool.
Definition DetourCrowd.h:190
dtReal nvel[3]
Definition DetourCrowd.h:160
dtCrowdAgentParams params
The agent's configuration parameters.
Definition DetourCrowd.h:164
Definition DetourCrowd.h:67
dtReal dist
The distance between the current agent and the neighbor.
Definition DetourCrowd.h:69
int idx
The index of the neighbor in the crowd.
Definition DetourCrowd.h:68
Definition DetourObstacleAvoidance.h:87