|
Kemena3D
|
A dynamic cylinder obstacle carved into the navmesh at runtime. More...
#include <knavobstacle.h>
Public Member Functions | |
| kNavObstacle () | |
| Constructs an empty, uninitialised obstacle (no tile-cache binding). | |
| ~kNavObstacle () | |
| Destroys the obstacle, removing it from the tile cache if still valid. | |
| kVec3 | getPosition () const |
| Returns the obstacle's current world-space centre position. | |
| float | getRadius () const |
| Returns the obstacle cylinder's radius. | |
| float | getHeight () const |
| Returns the obstacle cylinder's height. | |
| void | setPosition (const kVec3 &pos) |
| Moves the obstacle to a new world-space position. | |
| bool | isValid () const |
| Returns true if the obstacle is registered in the tile cache. | |
| bool | init (void *tileCache, const kVec3 &position, float radius, float height) |
| Registers the obstacle as a cylinder in the given tile cache. | |
| void | uninit () |
| Removes the obstacle from the tile cache and marks it invalid. | |
| unsigned int | getObstacleRef () const |
| Returns the underlying Detour obstacle reference. | |
A dynamic cylinder obstacle carved into the navmesh at runtime.
Obstacles require a tiled navmesh (kNavBuildConfig::tileSize > 0). Do not create directly — obtain via kNavManager::addObstacle().
| kemena::kNavObstacle::kNavObstacle | ( | ) |
Constructs an empty, uninitialised obstacle (no tile-cache binding).
| kemena::kNavObstacle::~kNavObstacle | ( | ) |
Destroys the obstacle, removing it from the tile cache if still valid.
| float kemena::kNavObstacle::getHeight | ( | ) | const |
Returns the obstacle cylinder's height.
| unsigned int kemena::kNavObstacle::getObstacleRef | ( | ) | const |
Returns the underlying Detour obstacle reference.
| kVec3 kemena::kNavObstacle::getPosition | ( | ) | const |
Returns the obstacle's current world-space centre position.
| float kemena::kNavObstacle::getRadius | ( | ) | const |
Returns the obstacle cylinder's radius.
| bool kemena::kNavObstacle::init | ( | void * | tileCache, |
| const kVec3 & | position, | ||
| float | radius, | ||
| float | height ) |
Registers the obstacle as a cylinder in the given tile cache.
Stores the position/radius/height and calls dtTileCache::addObstacle(). Intended for internal use by kNavManager; callers should obtain obstacles via kNavManager::addObstacle() instead.
| tileCache | Opaque pointer to the owning dtTileCache. |
| position | World-space centre position of the cylinder. |
| radius | Cylinder radius in world units. |
| height | Cylinder height in world units. |
| bool kemena::kNavObstacle::isValid | ( | ) | const |
Returns true if the obstacle is registered in the tile cache.
| void kemena::kNavObstacle::setPosition | ( | const kVec3 & | pos | ) |
Moves the obstacle to a new world-space position.
Internally removes the old dtObstacleRef and adds a new one. Affected tiles are flagged for re-baking on the next kNavManager::update() call. Has no effect if the obstacle is not bound to a tile cache or is currently invalid.
| pos | The new world-space centre position for the obstacle. |
| void kemena::kNavObstacle::uninit | ( | ) |
Removes the obstacle from the tile cache and marks it invalid.
Safe to call multiple times; does nothing if not currently valid.