3#include <Core/World/Component.h>
4#include <Core/World/World.h>
5#include <RecastPlugin/Components/AgentSteeringComponent.h>
6#include <RecastPlugin/RecastPluginDLL.h>
16 using StorageType = plUInt8;
21 MatchVelocityDirection,
23 Default = LookAtNextPathCorner
39 virtual void Initialize()
override;
46 plUInt32 m_uiNextOwnerId = 1;
67 virtual void SerializeComponent(
plWorldWriter& stream)
const override;
68 virtual void DeserializeComponent(
plWorldReader& stream)
override;
81 virtual void SetTargetPosition(
const plVec3& vPosition)
override;
82 virtual plVec3 GetTargetPosition()
const override {
return m_vTargetPosition; }
83 virtual void ClearTargetPosition()
override;
84 virtual plAgentPathFindingState::Enum GetPathToTargetState()
const override {
return m_PathToTargetState; }
89 float m_fRadius = 0.3f;
90 float m_fHeight = 1.8f;
91 float m_fMaxSpeed = 3.5f;
92 float m_fMaxAcceleration = 3.5f;
93 float m_fStoppingDistance = 1.0f;
96 float m_fPushiness = 2.0f;
99 float GetRadius()
const {
return m_fRadius; }
100 float GetHeight()
const {
return m_fHeight; }
101 float GetMaxSpeed()
const {
return m_fMaxSpeed; }
102 float GetMaxAcceleration()
const {
return m_fMaxAcceleration; }
103 float GetStoppingDistance()
const {
return m_fStoppingDistance; }
104 plAngle GetMaxAngularSpeed()
const {
return m_MaxAngularSpeed; }
108 plDetourCrowdAgentRotationMode::Enum GetRotationMode()
const {
return m_RotationMode; }
109 float GetPushiness()
const {
return m_fPushiness; }
111 void SetRadius(
float fRadius);
112 void SetHeight(
float fHeight);
113 void SetMaxSpeed(
float fMaxSpeed);
114 void SetMaxAcceleration(
float fMaxAcceleration);
116 void SetStoppingDistance(
float fStoppingDistance);
117 void SetMaxAngularSpeed(
plAngle maxAngularSpeed);
118 void SetRotationMode(plDetourCrowdAgentRotationMode::Enum rotationMode) { m_RotationMode = rotationMode; }
121 void SetPushiness(
float fPushiness);
123 plVec3 GetVelocity()
const {
return m_vVelocity; }
124 plAngle GetAngularSpeed()
const {
return m_AngularSpeed; }
131 virtual void OnDeactivated()
override;
134 plVec3 GetDirectionToNextPathCorner(
const plVec3& vCurrentPos,
const struct dtCrowdAgent* pDtAgent)
const;
135 bool SyncRotation(
const plVec3& vPosition,
plQuat& inout_qRotation,
const plVec3& vVelocity,
const struct dtCrowdAgent* pDtAgent);
137 void SyncTransform(
const struct dtCrowdAgent* pDtAgent,
bool bTeleport);
139 plUInt8 m_uiTargetDirtyBit : 1;
140 plUInt8 m_uiSteeringFailedBit : 1;
141 plUInt8 m_uiErrorBit : 1;
142 plUInt8 m_uiParamsDirtyBit : 1;
144 plInt32 m_iAgentId = -1;
145 plUInt32 m_uiOwnerId = 0;
149 plVec3 m_vActualTargetPosition;
Base class for components that implement 'agent steering' behavior. If, moving from point A to point ...
Definition AgentSteeringComponent.h:44
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
static constexpr plAngle MakeFromDegree(float fDegree)
Creates an instance of plAngle that was initialized from degree. (Performs a conversion)
Definition Angle_inl.h:33
Definition ComponentManager.h:88
Implements navigation, path following and obstacle avoidance. Requires Recast navmesh.
Definition DetourCrowdAgentComponent.h:60
plVec3 GetActualTargetPosition() const
While GetTargetPosition() returns the requested target position, this one will return the actual poin...
Definition DetourCrowdAgentComponent.h:107
Definition DetourCrowdAgentComponent.h:32
Definition DetourCrowdWorldModule.h:46
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
Definition DetourCrowdWorldModule.h:13
Definition DetourCrowdAgentComponent.h:15
A custom enum implementation that allows to define the underlying storage type to control its memory ...
Definition Enum.h:37
Definition WorldModule.h:33