3#include <Core/World/Component.h>
4#include <Core/World/World.h>
5#include <DetourNavMeshQuery.h>
6#include <DetourPathCorridor.h>
7#include <RecastPlugin/Components/AgentSteeringComponent.h>
8#include <RecastPlugin/Components/RecastNavMeshComponent.h>
9#include <RecastPlugin/NavMeshBuilder/NavMeshBuilder.h>
10#include <RecastPlugin/RecastPluginDLL.h>
26 virtual void Initialize()
override;
27 virtual void Deinitialize()
override;
49 virtual void SerializeComponent(
plWorldWriter& stream)
const override;
50 virtual void DeserializeComponent(
plWorldReader& stream)
override;
59 virtual void SetTargetPosition(
const plVec3& vPosition)
override;
60 virtual plVec3 GetTargetPosition()
const override;
61 virtual void ClearTargetPosition()
override;
62 virtual plAgentPathFindingState::Enum GetPathToTargetState()
const override;
68 plResult FindNavMeshPolyAt(
const plVec3& vPosition, dtPolyRef& out_polyRef,
plVec3* out_pAdjustedPosition =
nullptr,
float fPlaneEpsilon = 0.01f,
69 float fHeightEpsilon = 1.0f)
const;
70 bool HasReachedPosition(
const plVec3& vPos,
float fMaxDistance)
const;
71 bool HasReachedGoal(
float fMaxDistance)
const;
72 bool IsPositionVisible(
const plVec3& vPos)
const;
78 void VisualizePathCorridorPosition();
79 void VisualizePathCorridor();
80 void VisualizeCurrentPath();
81 void VisualizeTargetPosition();
88 plResult ComputePathCorridor(dtPolyRef startPoly, dtPolyRef endPoly,
bool& bFoundPartialPath);
89 void ComputeSteeringDirection(
float fMaxDistance);
90 void ApplySteering(
const plVec3& vDirection,
float fSpeed);
91 void SyncSteeringWithReality();
96 plVec3 m_vCurrentPositionOnNavmesh;
99 dtQueryFilter m_QueryFilter;
102 plInt32 m_iFirstNextStep = 0;
103 plInt32 m_iNumNextSteps = 0;
105 plVec3 m_vCurrentSteeringDirection;
111 float m_fWalkSpeed = 4.0f;
121 void UninitializeRecast();
122 virtual void OnSimulationStarted()
override;
125 bool m_bRecastInitialized =
false;
Base class for components that implement 'agent steering' behavior. If, moving from point A to point ...
Definition AgentSteeringComponent.h:44
Definition ComponentManager.h:88
Definition DynamicArray.h:81
Definition PhysicsWorldModule.h:109
Definition RecastAgentComponent.h:42
Definition RecastAgentComponent.h:19
Definition RecastWorldModule.h:16
A Unique ptr manages an object and destroys that object when it goes out of scope....
Definition UniquePtr.h:10
A world encapsulates a scene graph of game objects and various component managers and their component...
Definition World.h:22
Reads a world description from a stream. Allows to instantiate that world multiple times in different...
Definition WorldReader.h:47
Stores an entire plWorld in a stream.
Definition WorldWriter.h:13
A handle to a component.
Definition Declarations.h:138
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
These events may be sent by a specific plResource or by the plResourceManager.
Definition Declarations.h:22
Default enum for returning failure or success, instead of using a bool.
Definition Types.h:54
Definition WorldModule.h:33