Kemena3D
Loading...
Searching...
No Matches
knavmanager.h
Go to the documentation of this file.
1
5
6#ifndef KNAVMANAGER_H
7#define KNAVMANAGER_H
8
9#include "kexport.h"
10#include "kdatatype.h"
11#include "knavmesh.h"
12#include "knavagent.h"
13#include "knavobstacle.h"
14
15#include <vector>
16
17namespace kemena
18{
19 // -------------------------------------------------------------------------
20 // kNavManager
21 // -------------------------------------------------------------------------
22
44 {
45 public:
52 kNavManager(kNavMesh *mesh, int maxAgents = 128);
53
56
57 // --- Lifecycle -------------------------------------------------------
58
63 bool init();
64
66 void shutdown();
67
72 void update(float deltaTime);
73
74 // --- Agents ----------------------------------------------------------
75
80 kNavAgent* addAgent(const kVec3 &position,
81 const kNavAgentConfig &config = {});
82
88 void removeAgent(kNavAgent *agent);
89
91 const std::vector<kNavAgent*> &getAgents() const;
92
93 // --- Obstacles -------------------------------------------------------
94
106 float radius, float height);
107
114
116 const std::vector<kNavObstacle*> &getObstacles() const;
117
118 // --- Query -----------------------------------------------------------
119
122
123 protected:
124 private:
125 struct Impl;
126 Impl *m_impl;
127 };
128
129} // namespace kemena
130
131#endif // KNAVMANAGER_H
A single crowd agent managed by kNavManager.
Definition knavagent.h:63
void removeObstacle(kNavObstacle *obstacle)
Removes and destroys a dynamic obstacle.
kNavAgent * addAgent(const kVec3 &position, const kNavAgentConfig &config={})
Adds a new crowd agent at position.
void shutdown()
Shuts down crowd and releases all agents / obstacles.
bool init()
Initialises the internal dtCrowd.
const std::vector< kNavObstacle * > & getObstacles() const
All currently registered obstacles.
kNavMesh * getNavMesh() const
Returns the kNavMesh this manager was created with.
void removeAgent(kNavAgent *agent)
Removes and destroys an agent.
const std::vector< kNavAgent * > & getAgents() const
All currently active agents.
kNavObstacle * addObstacle(const kVec3 &position, float radius, float height)
Adds a dynamic cylinder obstacle.
void update(float deltaTime)
Steps the crowd simulation and rebuilds any dirty tiles.
kNavManager(kNavMesh *mesh, int maxAgents=128)
Constructs a navigation manager for a baked navmesh.
~kNavManager()
Destroys the manager, shutting down the crowd and freeing agents/obstacles.
A baked navigation mesh used for pathfinding and obstacle simulation.
Definition knavmesh.h:140
A dynamic cylinder obstacle carved into the navmesh at runtime.
Definition knavobstacle.h:31
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
Navigation crowd agent driven by Detour Crowd.
Navigation mesh baking and pathfinding.
Dynamic navigation obstacle (cylinder) backed by dtTileCache.
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