A single crowd agent managed by kNavManager.
More...
#include <knavagent.h>
|
| | kNavAgent () |
| | Constructs an uninitialised agent; call init() before use.
|
| | ~kNavAgent () |
| | Destroys the agent, releasing internal crowd resources.
|
| bool | setTarget (const kVec3 &target) |
| | Sets the movement target on the navmesh.
|
| void | stop () |
| | Stops the agent in place.
|
| kVec3 | getPosition () const |
| | Current world-space position of the agent.
|
| kVec3 | getVelocity () const |
| | Current world-space velocity of the agent.
|
| bool | isMoving () const |
| | Returns true if the agent is actively moving toward a target.
|
| bool | isValid () const |
| | Returns true if this agent slot is active in the crowd.
|
| void | setMaxSpeed (float speed) |
| | Overrides the agent's maximum speed at runtime.
|
| void | setMaxAcceleration (float accel) |
| | Overrides the agent's maximum acceleration at runtime.
|
| float | getMaxSpeed () const |
| | Returns the agent's current maximum speed.
|
| float | getMaxAcceleration () const |
| | Returns the agent's current maximum acceleration.
|
| bool | init (void *crowd, void *navMeshQuery, const kVec3 &position, const kNavAgentConfig &config) |
| | Initialises the agent inside an existing dtCrowd.
|
| void | uninit () |
| | Removes the agent from the crowd.
|
| int | getAgentIndex () const |
| | Returns the internal crowd agent index.
|
A single crowd agent managed by kNavManager.
Do not create directly — obtain via kNavManager::addAgent(). The agent is driven by Detour Crowd each frame and moves toward its current target.
kNavAgent* agent = navManager->addAgent(spawnPos, config);
kVec3 getPosition() const
Current world-space position of the agent.
kNavAgent()
Constructs an uninitialised agent; call init() before use.
bool setTarget(const kVec3 &target)
Sets the movement target on the navmesh.
◆ kNavAgent()
| kemena::kNavAgent::kNavAgent |
( |
| ) |
|
Constructs an uninitialised agent; call init() before use.
◆ ~kNavAgent()
| kemena::kNavAgent::~kNavAgent |
( |
| ) |
|
Destroys the agent, releasing internal crowd resources.
◆ getAgentIndex()
| int kemena::kNavAgent::getAgentIndex |
( |
| ) |
const |
Returns the internal crowd agent index.
- Returns
- Index of this agent within the dtCrowd, or -1 if inactive.
◆ getMaxAcceleration()
| float kemena::kNavAgent::getMaxAcceleration |
( |
| ) |
const |
Returns the agent's current maximum acceleration.
- Returns
- Maximum acceleration (m/s²).
◆ getMaxSpeed()
| float kemena::kNavAgent::getMaxSpeed |
( |
| ) |
const |
Returns the agent's current maximum speed.
- Returns
- Maximum speed (m/s).
◆ getPosition()
| kVec3 kemena::kNavAgent::getPosition |
( |
| ) |
const |
Current world-space position of the agent.
◆ getVelocity()
| kVec3 kemena::kNavAgent::getVelocity |
( |
| ) |
const |
Current world-space velocity of the agent.
◆ init()
| bool kemena::kNavAgent::init |
( |
void * | crowd, |
|
|
void * | navMeshQuery, |
|
|
const kVec3 & | position, |
|
|
const kNavAgentConfig & | config ) |
Initialises the agent inside an existing dtCrowd.
- Parameters
-
| crowd | Opaque pointer to the owning dtCrowd instance. |
| navMeshQuery | Opaque pointer to the dtNavMeshQuery used for navigation. |
| position | Initial world-space spawn position of the agent. |
| config | Per-agent parameters to apply on creation. |
- Returns
- false if the agent could not be added to the crowd.
◆ isMoving()
| bool kemena::kNavAgent::isMoving |
( |
| ) |
const |
Returns true if the agent is actively moving toward a target.
◆ isValid()
| bool kemena::kNavAgent::isValid |
( |
| ) |
const |
Returns true if this agent slot is active in the crowd.
◆ setMaxAcceleration()
| void kemena::kNavAgent::setMaxAcceleration |
( |
float | accel | ) |
|
Overrides the agent's maximum acceleration at runtime.
- Parameters
-
| accel | New maximum acceleration (m/s²). |
◆ setMaxSpeed()
| void kemena::kNavAgent::setMaxSpeed |
( |
float | speed | ) |
|
Overrides the agent's maximum speed at runtime.
- Parameters
-
| speed | New maximum speed (m/s). |
◆ setTarget()
| bool kemena::kNavAgent::setTarget |
( |
const kVec3 & | target | ) |
|
Sets the movement target on the navmesh.
- Parameters
-
| target | Desired world-space goal position. |
- Returns
- false if the target is off the navmesh or the agent is invalid.
◆ stop()
| void kemena::kNavAgent::stop |
( |
| ) |
|
Stops the agent in place.
◆ uninit()
| void kemena::kNavAgent::uninit |
( |
| ) |
|
Removes the agent from the crowd.
The documentation for this class was generated from the following file: