Kemena3D
Loading...
Searching...
No Matches
knavagent.h
Go to the documentation of this file.
1
5
6#ifndef KNAVAGENT_H
7#define KNAVAGENT_H
8
9#include "kexport.h"
10#include "kdatatype.h"
11
12namespace kemena
13{
14 // -------------------------------------------------------------------------
15 // Agent configuration
16 // -------------------------------------------------------------------------
17
24 {
25 float radius = 0.6f;
26 float height = 2.0f;
27 float maxAcceleration = 8.0f;
28 float maxSpeed = 3.5f;
29
31 float pathOptRange = 30.0f;
32
34 float separationWeight = 2.0f;
35
37 bool anticipateTurns = true;
38 bool optimizeVis = true;
39 bool optimizeTopo = true;
40 bool obstacleAvoidance = true;
41 bool separation = false;
42 };
43
44 // -------------------------------------------------------------------------
45 // kNavAgent
46 // -------------------------------------------------------------------------
47
63 {
64 public:
67
70
71 // --- Target ----------------------------------------------------------
72
78 bool setTarget(const kVec3 &target);
79
81 void stop();
82
83 // --- Query -----------------------------------------------------------
84
87
90
92 bool isMoving() const;
93
95 bool isValid() const;
96
97 // --- Runtime parameter overrides ------------------------------------
98
103 void setMaxSpeed(float speed);
104
109 void setMaxAcceleration(float accel);
110
115 float getMaxSpeed() const;
116
121 float getMaxAcceleration() const;
122
123 // --- Internal (used by kNavManager) ----------------------------------
124
133 bool init(void *crowd, void *navMeshQuery,
134 const kVec3 &position, const kNavAgentConfig &config);
135
137 void uninit();
138
143 int getAgentIndex() const;
144
145 protected:
146 private:
147 struct Impl;
148 Impl *m_impl;
149 };
150
151} // namespace kemena
152
153#endif // KNAVAGENT_H
bool isValid() const
Returns true if this agent slot is active in the crowd.
void setMaxAcceleration(float accel)
Overrides the agent's maximum acceleration at runtime.
kVec3 getPosition() const
Current world-space position of the agent.
bool isMoving() const
Returns true if the agent is actively moving toward a target.
bool init(void *crowd, void *navMeshQuery, const kVec3 &position, const kNavAgentConfig &config)
Initialises the agent inside an existing dtCrowd.
void setMaxSpeed(float speed)
Overrides the agent's maximum speed at runtime.
kVec3 getVelocity() const
Current world-space velocity of the agent.
void uninit()
Removes the agent from the crowd.
~kNavAgent()
Destroys the agent, releasing internal crowd resources.
float getMaxSpeed() const
Returns the agent's current maximum speed.
int getAgentIndex() const
Returns the internal crowd agent index.
kNavAgent()
Constructs an uninitialised agent; call init() before use.
void stop()
Stops the agent in place.
bool setTarget(const kVec3 &target)
Sets the movement target on the navmesh.
float getMaxAcceleration() const
Returns the agent's current maximum acceleration.
Core type aliases, enumerations, structs, and utility functions used throughout the engine.
Symbol visibility / linkage macro for the Kemena3D library.
#define KEMENA3D_API
Definition kexport.h:35
Top-level Kemena3D engine namespace.
Definition kanimation.h:23
glm::vec3 kVec3
3-component float vector.
Definition kdatatype.h:33
Per-agent parameters passed to dtCrowd on creation.
Definition knavagent.h:24
bool optimizeVis
Optimise path visibility.
Definition knavagent.h:38
bool separation
Enable crowd separation.
Definition knavagent.h:41
float separationWeight
Definition knavagent.h:34
float pathOptRange
Definition knavagent.h:31
float radius
Agent cylinder radius (m).
Definition knavagent.h:25
bool anticipateTurns
Definition knavagent.h:37
bool optimizeTopo
Optimise path topology.
Definition knavagent.h:39
float height
Agent cylinder height (m).
Definition knavagent.h:26
bool obstacleAvoidance
Use local steering avoidance.
Definition knavagent.h:40
float maxAcceleration
Maximum acceleration (m/s²).
Definition knavagent.h:27
float maxSpeed
Maximum speed (m/s).
Definition knavagent.h:28