Kaim::BoxObstacle Class Reference

Kaim::BoxObstacle Class Reference

#include <boxobstacle.h>

Class Description

Each instance of the BoxObstacle class represents a dynamic, physical object in your game engine that will prevent your Bots from moving freely through its bounding box.

Typical examples are crates, furniture, movable or destructible walls, rubble, vehicles, doors, etc.

By default BoxObstacles are integrated in avoidance trajectory computation through their bounding cylinders. If your game obstacle does not move, you can set DoesTriggerTagVolume to true to make Gameware Navigation spawn and manage a TagVolume around the BoxObstacle that will be integrated into the DynamicNavMesh.

+ Examples:

Inherits Kaim::WorldElement.

Main API Functions

 BoxObstacle ()
 
 BoxObstacle (const BoxObstacleInitConfig &initConfig)
 
virtual ~BoxObstacle ()
 
void Init (const BoxObstacleInitConfig &initConfig)
 
void Clear ()
 
void AddToWorld ()
 
void RemoveFromWorld ()
 
void SetTransform (const Transform &transform)
 
void SetLinearVelocity (const Vec3f &linearVelocity)
 
void SetAngularVelocity (const Vec3f &angularVelocity)
 
void SetRotationMode (BoxObstacleRotationMode mode)
 
void SetDoesTriggerTagVolume (bool triggerTagVolume)
 

Getters

static const char * GetRotationModeDescription (BoxObstacleRotationMode rotationMode)
 
const Vec3fGetLocalCenter () const
 
const Vec3fGetLocalHalfExtents () const
 
const Vec3fGetLinearVelocity () const
 
const Vec3fGetAngularVelocity () const
 
const TransformGetTransform () const
 
BoxObstacleRotationMode GetRotationMode () const
 
const TagVolumeGetTagVolume () const
 
const DynamicNavTag & GetNavTag () const
 
KyUInt32 GetSpatializedCylinderCount () const
 
const SpatializedCylinderGetSpatializedCylinder (KyUInt32 index) const
 
TagVolume::IntegrationStatus GetTagVolumeIntegrationStatus () const
 
const DatabaseBindingGetDatabaseBinding () const
 
bool DoesTriggerTagVolume () const
 

For internal use only

virtual void DoSendVisualDebug (VisualDebugServer &visualDebugServer, VisualDebugSendChangeEvent changeEvent)
 
void UpdateSpatialization ()
 
void SetupTagVolumeInitConfig (TagVolumeInitConfig &tagVolumeInitConfig)
 
void OnTagVolumeIntegration ()
 
SpatializedCylinderGetCentralSpatializedCylinder ()
 
KyUInt32 GetSampledSpatializedCylinderCount ()
 
SpatializedCylinderGetSampledSpatializedCylinder (KyUInt32 index)
 
TagVolumeGetTagVolume ()
 

Input

Ptr< DatabaseBindingm_databaseBinding
 
DynamicNavTag m_navTag
 
Vec3f m_localCenter
 
Vec3f m_localHalfExtents
 
BoxObstacleUpAxis m_upAxis
 
BoxObstacleRotationMode m_rotationMode
 
bool m_doesTriggerTagVolume
 
Transform m_transform
 
Vec3f m_linearVelocity
 
Vec3f m_angularVelocity
 

Obstacle state

TagVolumeTrigger< BoxObstaclem_tagVolumeTrigger
 
SpatializedCylinder m_centralSpatializedCylinder
 
SpatializedCylinderm_sampledSpatializedCylinders
 
Vec3fm_sampledSpatializedCylinderLocalPositions
 
KyUInt32 m_sampledSpatializedCylinderCount
 

Main API Functions

bool IsAddedToWorld () const
 
WorldGetWorld () const
 
KyUInt32 GetVisualDebugId () const
 
void * GetUserData () const
 
void SetUserData (void *userData)
 

Visual Debug

void SetCurrentVisualDebugLOD (VisualDebugLOD lod)
 
VisualDebugLOD GetCurrentVisualDebugLOD () const
 
VisualDebugLOD GetPreviousVisualDebugLod () const
 
void SendVisualDebug (VisualDebugServer &server)
 
void ForceSendAllVisualDebug ()
 

For internal use only

void SendForMaxLevelOfDetail (VisualDebugServer &server, const Vec3f &shapePosition)
 
void RegisterToVisualDebug ()
 
void UnRegisterFromVisualDebug ()
 
KyUInt32 GetIndexInCollection () const
 
void SetIndexInCollection (KyUInt32 indexInCollection)
 

Member Function Documentation

void Kaim::BoxObstacle::AddToWorld ( )

Adds the BoxObstacle to the World.

Once added, it becomes active in the simulation, is updated, taken into account by Bots, etc.

This increments the RefCount of this instance.

NOTE: this method has immediate effect: ensure to call this outside of any Gameware Navigation computation (World::Update() or threaded query computation). However, the spatialization is not updated immediately, this will be done in next World::Update().

+ Examples:
void Kaim::BoxObstacle::Clear ( )

Prepares this instance for destruction and / or reuse: sets all members to their default values and clears all SpatializedCylinders.

bool Kaim::BoxObstacle::DoesTriggerTagVolume ( ) const
inline

Returns whether the TriggerTagVolume flag is raised or not; not if the BoxObstacle has actually triggered a TagVolume.

To get current TagVolume status, use GetTagVolumeIntegrationStatus() method.

void Kaim::WorldElement::ForceSendAllVisualDebug ( )
inherited

Call this when something impacts all your visual debug data.

It will set the event to VisualDebugSendChangeEvent_ForceSendAll. (called internally when connecting with a VisualDebug client).

static const char* Kaim::BoxObstacle::GetRotationModeDescription ( BoxObstacleRotationMode  rotationMode)
static

Returns a short description of the rotation mode for visual debug.

void Kaim::BoxObstacle::Init ( const BoxObstacleInitConfig initConfig)

Sets m_world and allocates memory depending on m_databaseBinding; it does not add the obstacle to the world, and does not modify the world.

If m_world is already set, the obstacle is first removed from m_world.

Asserts if initConfig.m_world == NULL, or if half extents are invalid.

+ Examples:
void Kaim::BoxObstacle::RemoveFromWorld ( )

Removes the BoxObstacle from the World.

It is removed from the simulation, updates are stopped, and it is ignored by Bots.

This decrements the RefCount of this instance.

NOTE: this method has immediate effect: ensure to call this outside of any Gameware Navigation computation (Kaim::World::Update or threaded query computation). The spatialization information are immediately invalidated too.

void Kaim::BoxObstacle::SetAngularVelocity ( const Vec3f angularVelocity)

The rotational speed as rotation vector.

This should provides at once rotation axis and angular speed (in radians per second).

+ Examples:
void Kaim::WorldElement::SetCurrentVisualDebugLOD ( VisualDebugLOD  lod)
inlineinherited

Set the visual debug level of details to use for this WorldElement instance.

Generally, setting this to VisualDebugLOD_Minimal, sends almost nothing but position and status, whereas setting it to VisualDebugLOD_Maximal sends all available debug information including spatialization and some internal algorithm results.

void Kaim::BoxObstacle::SetDoesTriggerTagVolume ( bool  triggerTagVolume)

This information is copied and applied in the next World::Update.

Setting to true will trigger a TagVolume for this BoxObstacle during the next World::Update. The TagVolume will then be integrated into the DynamicNavMesh, and the obstacle will be no longer be visible as sampled cylinders nor integrated into avoidance computation.

While set to true, the position is not updated. If the obstacle triggering a TagVolume is moved, set to false, wait at least one frame to ensure the BoxObstacle is updated, then set it back to true once your obstacle is stationary again.

void Kaim::BoxObstacle::SetLinearVelocity ( const Vec3f linearVelocity)

The linear velocity at the local transform center of the box.

+ Examples:
void Kaim::BoxObstacle::SetRotationMode ( BoxObstacleRotationMode  mode)

Sets the next rotation mode used to update this BoxObstacle.

For BoxObstacleUpdateConfig, the BoxObstacleRotationMode is copied and applied in the next World::Update.

void Kaim::BoxObstacle::SetTransform ( const Transform transform)

The transform of the box.

+ Examples:

Member Data Documentation

Vec3f Kaim::BoxObstacle::m_angularVelocity
private

Stores the rotational speed as rotation vector expressed in World coordinate system.

This should provides at once rotation axis and angular speed (in radians per second).

Vec3f Kaim::BoxObstacle::m_linearVelocity
private

The linear velocity, expressed in World coordinate system, at the local transform center of the box.


The documentation for this class was generated from the following file: