Kaim::Bot Class Reference

Kaim::Bot Class Reference

#include <bot.h>

Class Description

This class is the world element that represent an active character in Gameware Navigation.

It manages character pathfinding and pathfollowing.

+ Examples:

Inherits Kaim::WorldElement.

Initialization / Clearing

 Bot ()
 
 Bot (const BotInitConfig &initConfig)
 
 Bot (const BotInitConfig &initConfig, const BotConfig &botConfig)
 
virtual ~Bot ()
 
void Init (const BotInitConfig &initConfig)
 
void Init (const BotInitConfig &initConfig, const BotConfig &botConfig)
 
void Clear ()
 
void AddToDatabase ()
 
void RemoveFromDatabase ()
 

BotInput

These methods have to be called to update Bot position, velocity and front direction.

it has to be called each time the corresponding character is updated in the game engine.

Note that for convenience velocity and frontDirection can be automatically computed from position and velocity respectively.

void SetPosition (const Vec3f &position)
 
void SetVelocity (const Vec3f &velocity)
 
void SetFrontDirection (const Vec2f &frontDirection)
 
void SetPositionAndVelocityAndFrontDirection (const Vec3f &position, KyFloat32 simulationTimeInSeconds)
 
void SetPositionAndVelocity (const Vec3f &position, KyFloat32 simulationTimeInSeconds)
 
void SetVelocityAndFrontDirection (const Vec3f &velocity)
 

BotOutput

const BotOutputGetBotOutput () const
 

Getters

static const char * GetProgressOnLivePathStatusDescription (ProgressOnPathStatus status)
 
const Vec3fGetPosition () const
 
const Vec2fGetFrontDirection () const
 
const Vec3fGetVelocity () const
 
const SpatializedCylinderGetSpatializedCylinder () const
 
const Vec3fGetPreviousPosition () const
 
NavTrianglePtr GetNavTrianglePtr () const
 
const ChannelSectionPtr & GetChannelSectionPtr () const
 
DatabaseGetDatabase () const
 
IPathFinderQueryGetPathFinderQuery ()
 
BasePathProgressComputerGetPathProgressComputer () const
 
TrajectoryGetTrajectory () const
 
const PositionOnLivePathGetProgressOnLivePath () const
 
ProgressOnPathStatus GetProgressOnLivePathStatus () const
 
KyFloat32 GetRemainingDistanceFromProgressToEndOfPath () const
 
const BotConfigGetConfig () const
 

Bot Shape Config

void SetRadius (KyFloat32 radius)
 
KyFloat32 GetRadius () const
 
void SetHeight (KyFloat32 height)
 
KyFloat32 GetHeight () const
 

Trajectory Mode

void SetTrajectoryMode (TrajectoryMode trajectoryMode)
 
TrajectoryMode GetTrajectoryMode () const
 

PathFind Config

void SetPathFinderConfig (const PathFinderConfig &pathFinderConfig)
 
const PathFinderConfigGetPathFinderConfig () const
 
void SetChannelComputerConfig (const ChannelComputerConfig &channelComputerConfig)
 
const ChannelComputerConfigGetChannelComputerConfigConfig () const
 

Path Progress Config

void SetPathProgressConfig (const PathProgressConfig &pathProgressConfig)
 
const PathProgressConfigGetPathProgressConfig () const
 

Trajectory Config

void SetMaxDesiredLinearSpeed (KyFloat32 maxDesiredLinearSpeed)
 
KyFloat32 GetMaxDesiredLinearSpeed () const
 
void SetTrajectoryFailureMode (TrajectoryFailureMode trajectoryFailureMode)
 
TrajectoryFailureMode GetTrajectoryFailureMode () const
 
void SetShortcutTrajectoryConfig (const ShortcutTrajectoryConfig &shortcutTrajectoryConfig)
 
const ShortcutTrajectoryConfigGetShortcutTrajectoryConfig () const
 
void SetSplineTrajectoryConfig (const SplineTrajectoryConfig &splineTrajectoryConfig)
 
const SplineTrajectoryConfigGetSplineTrajectoryConfig () const
 

Trajectory Avoidance

void SetEnableAvoidance (bool enable)
 
bool GetEnableAvoidance () const
 
void SetColliderCollectorConfig (const ColliderCollectorConfig &colliderCollectorConfig)
 
const ColliderCollectorConfigGetColliderCollectorConfig () const
 
void SetAvoidanceConfig (const AvoidanceConfig &avoidanceConfig)
 
const AvoidanceConfigGetAvoidanceConfig () const
 

Advanced Config

void SetTrajectoryMinimalMoveDistance (KyFloat32 trajectoryMinimalMoveDistance)
 
KyFloat32 GetTrajectoryMinimalMoveDistance () const
 
void SetLocalCostOnPathDistance (KyFloat32 localCostOnPathDistance)
 
KyFloat32 GetLocalCostOnPathDistance () const
 

Basic PathFinding functions

These functions are used to have the bot finding a Path very easily by only providing your AstarQuery and then the destination without going into the details of the different available Pathfinder queries and all their parameters.

As an helper, they are typically used during your first integration steps.

void SetNewPathNavigationProfileId (KyUInt32 navigationProfileId)
 
KyUInt32 GetNewPathNavigationProfileId () const
 
KyResult ComputeNewPathToDestination (const Vec3f &destPos)
 
KyResult ComputeNewPathToDestination (const Vec3f &destPos, const NavGraphEdgePtr &startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode=NAVGRAPHEDGE_BIDIRECTIONAL)
 

Advanced PathFinding functions

These functions should be used for advanced path finding scenarios.

With them you can set the IPathFinder query you want (not only an AStarQuery). You have to initialize your Query by yourself before calling the ComputeNewPathAsync() function and you are responsible for cheching the computation status (See IsComputingNewPath()) before calling ComputeNewPathAsync.

KyResult InitAStarQueryForBot (Ptr< BaseAStarQuery > &astarQuery, const Vec3f &destPos)
 
KyResult InitAStarQueryForBot (Ptr< BaseAStarQuery > &astarQuery, const Vec3f &destPos, const NavGraphEdgePtr &startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode=NAVGRAPHEDGE_BIDIRECTIONAL)
 
BaseNavigationProfileGetFollowedPathNavigationProfile ()
 
void * GetBotTraverseLogicUserData () const
 
void SetBotTraverseLogicUserData (void *traverseLogicUserData)
 
void ComputeNewPathAsync (IPathFinderQuery *pathFinderQuery)
 
void InjectNewPath (Path *newPath)
 
void CancelAsyncPathComputation ()
 
bool IsComputingNewPath () const
 

LivePath Management

const LivePathGetLivePath () const
 
const PathEventListGetPathEventList () const
 
const PathValidityIntervalGetPathValidityInterval () const
 
PathGetFollowedPath () const
 
PathSource GetFollowedPathSource () const
 
ChannelArrayGetChannelArray () const
 
void ClearFollowedPath ()
 
const PositionOnPathGetUpcomingEventPositionOnPath () const
 
const NavTag * GetUpcomingEventNavTag () const
 
const NavTag * GetPreviousEventNavTag () const
 

Path Following

bool HasReachedPosition (const Vec3f &position, KyFloat32 precisionRadius) const
 
void SetDoComputeProgressOnPath (bool doUpdateProgressOnPath)
 
bool GetDoComputeProgressOnPath () const
 
void SetDoValidateCheckPoint (bool doValidateCheckPoint)
 
bool GetDoValidateCheckPoint () const
 
void SetDoComputeTrajectory (bool doComputeTrajectory)
 
bool GetDoComputeTrajectory () const
 
void ForceRecomputeTrajectory ()
 
Vec3f ComputeMoveOnNavMesh (const Kaim::Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
 
template<class TraverseLogic >
Vec3f ComputeMoveOnNavMeshWithTraverseLogic (const Kaim::Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
 

Manual Control helper

Following function helps setting up the PathFollowing when user wants to take control of the Bot These functions computes an interval on which the Bot is going to follow the path in a particular way under control of the user.

this interval is computed based on the entry and the exit of NavTag along the path.

This interval is called ManualControlInterval.

Usage: if (bot->EnterManualControl(navTag) < ManualControlStatus_Pending) return; // Bot was not able to enter manual control; while (bot->ExitManualControl() < ResetTrajectoryStatus_Success) // Navigation cannot take back control, Bot didn't exit ManualControl GameContinueToMoveBotByItselfOrRecomputeAPath(); // Game should continue to move the Bot by its own logic or recompute a path.

ManualControlStatus EnterManualControl ()
 
ManualControlStatus EnterManualControl (const NavTag *navTag)
 
ManualControlStatus EnterManualControl (const DynamicNavTag *navTag)
 
ResetTrajectoryStatus ExitManualControl ()
 
void SetForceMinimizedSpatializationCoherency (bool forceMinimalCoherency)
 
bool GetForceMinimizedSpatializationCoherency () const
 

For internal use only

Databasem_database
 
void * m_traverseLogicUserData
 
Ptr< IPathFinderQuerym_pathFinderQuery
 
Ptr< BasePathProgressComputerm_pathProgressComputer
 
Ptr< Trajectorym_trajectory
 
LivePath m_livePath
 
SpatializedCylinder m_spatializedCylinder
 
ChannelSectionPtr m_positionInChannel
 
PositionOnLivePath m_progressOnLivePath
 
ProgressOnPathStatus m_progressOnPathStatus
 
Vec3f m_previousPosition
 
ManualControlInterval m_manualControlInterval
 
KyFloat32 m_localMaxCostMultiplierOnPath
 
Vec3f m_position
 
Vec3f m_velocity
 
Vec2f m_frontDirection
 
BotOutput m_botOutput
 
KyUInt32 m_newPathToDestNavigationProfileId
 
BotNavigationCollection m_botNavigationCollection
 
BotNeedFullComputeFlags m_botNeedFullComputeFlags
 
Vec3f m_lastCollectorPosition
 
Ptr< QueryDynamicOutputm_collectorOutput
 
KyFloat32 m_forcePassageTimer
 
KyFloat32 m_colliderTimer
 
void UpdatePathFollowing (KyFloat32 simulationTimeInSeconds)
 
void ComputeTrajectory (KyFloat32 simulationTimeInSeconds)
 
ResetTrajectoryStatus ResetTrajectory (const PositionOnLivePath &positionOnLivePath)
 
virtual void DoSendVisualDebug (VisualDebugServer &server, VisualDebugSendChangeEvent changeEvent)
 
void UpdateSpatialization ()
 
LivePathGetLivePath ()
 
PathEventListGetPathEventList ()
 
void FlagPathAsPotentiallyDirty ()
 
void ComputeBotRadiusAndHeight ()
 
NavTrianglePtr GetNavTrianglePtr (Database *boundDatabase) const
 

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)
 

Constructor & Destructor Documentation

Kaim::Bot::Bot ( const BotInitConfig initConfig)

calls Init(initConfig)

Kaim::Bot::Bot ( const BotInitConfig initConfig,
const BotConfig botConfig 
)

calls Init(initConfig, botConfig)

Member Function Documentation

void Kaim::Bot::AddToDatabase ( )

Adds the Bot to the Database (and thus to the World).

It becomes active in the simulation, it is updated, and it is taken into account by other Bots.

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().

void Kaim::Bot::CancelAsyncPathComputation ( )
inline

Cancel the current path computation.

You must call this method each time you want to compute a new path whereas the previous path computation query has not been completed.

void Kaim::Bot::Clear ( )

Prepares this instance for destruction and / or reuse: sets all members to their default values and clears: the spatialization, the path, the trajectory.

void Kaim::Bot::ClearFollowedPath ( )

Clears the current LivePath and associated events.

Sets the PathFollowing component controls to default: target on path and Trajectory will be computed when a new path will be provided.

Vec3f Kaim::Bot::ComputeMoveOnNavMesh ( const Kaim::Vec3f velocity,
KyFloat32  simulationTimeInSeconds 
)

Helper function to compute the position the bot would reach if you apply the velocity for simulationTimeInSeconds from its last spatialized position (cf.

GetSpatializedPosition()) Use this function to guarantee that the bot stays on a reachable valid position (we make use of the MoveOnNavMeshQuery) Gameware Navigation never moves the bot on its own, so you still need to call SetPosition/SetVelocity/SetFrontDirection This version use the TraverseLogic set on the current NavigationProfile

template<class TraverseLogic >
Vec3f Kaim::Bot::ComputeMoveOnNavMeshWithTraverseLogic ( const Kaim::Vec3f velocity,
KyFloat32  simulationTimeInSeconds 
)
inline

Helper function to compute the position the bot would reach if you apply the velocity for simulationTimeInSeconds from its last spatialized position (cf.

GetSpatializedPosition()) Use this function to guarantee that the bot stays on a reachable valid position (we make use of the MoveOnNavMeshQuery) Gameware Navigation never moves the bot on its own, so you still need to call SetPosition/SetVelocity/SetFrontDirection This version use the TraverseLogic you provide, and therefore save a virtual call i.e faster

void Kaim::Bot::ComputeNewPathAsync ( IPathFinderQuery pathFinderQuery)
inline

Launches a new path computation with a pathFinderQuery.

WARNING : This query must have been bound to the database in which the bot has been added and must be initialized, and your bot must not be computing a path (See IsComputingNewPath()).

If you want to force a recomputation while this is running, you must explicitely call CancelAsyncPathComputation() first.

Precondition
The bot must not be computing a Path. See IsComputingNewPath() function.
KyResult Kaim::Bot::ComputeNewPathToDestination ( const Vec3f destPos)
inline

Launches an asynchronous path computation from the Bot position to destPos.

If the Bot is already computing a Path, this computation is canceled, and a we try to launch a new path computation.

The launched PathFinderQuery will be an instance returned by the CreateAStarQuery() fonction of the current NavigationProfile.

If the AStarQuery cannot be initialized because of the Query Framework (We may have to wait for the next World::Update() for the query to be flushed from the QueryQueue), this function returns KY_ERROR. In this case, you could try to call it next frame.

Note that this function calls internally the ComputeNewPathAsync function. If you had previously called ComputeNewPathAsync() with a custom IPathFinderQuery then it will be canceled and replaced by the AStarQuery.

Optionally, you can force the path to start with a given NavGraph edge.

ManualControlStatus Kaim::Bot::EnterManualControl ( )

Call this function if you wish to take manual control of the Bot, i.e.

if you don't need a trajectory to be computed and progress should ignore checkpoints e.g. a SmartObject takes control of the Bot.

The entry point of the ManualControlInterval will be set to m_progressOnLivePath.

No exit point will be computed, m_progressOnLivePath will be used at exit point, which means that ExitManualControl will rely solely on the geometric update of the m_progressOnLivePath during the Manual Control.

Prefer EnterManualControl(const NavTag& navTag) which allows to force the exit point at the end of the NavTag on the path, particularly if during the Manual Control, the Bot has a trajectory that goes outside the Path (jump, animations...).

ManualControlStatus Kaim::Bot::EnterManualControl ( const NavTag *  navTag)

Call this function if you wish to take manual control of the Bot on a given NavTag i.e.

if you don't need a trajectory to be computed and progress should ignore checkpoints e.g. a SmartObject takes control of the Bot.

The entry and exit point of the ManualControlInterval will computed from m_progressOnLivePath based on the next or current portion of path that is on the given NavTag.

On ExitManualControl, m_progressOnLivePath will be force to the exit point, if the trajectory can be reset at this point.

Returns
ManualControlStatus indicates if the Bot is now under Manual Control or not.

The following two values indicates the Bot is considered under ManualControl ManualControl_Valid indicates that both entry and exit points are found and valid, it is now up to the user to compute a trajectory ManualControl_Pending indicates that entry point is known and exit points remains under validation due to the path not being valid either after this point, they both will be updated on next updates.

Other values indicate that the Bot cannot enter ManualControl.

ResetTrajectoryStatus Kaim::Bot::ExitManualControl ( )

If EnterManualControl() was called without NavTag then the current m_progressOnLivePath is used.

During the Manual control, m_progressOnLivePath was updated as usual i.e. only based on geometric criterion.

If EnterManualControl() was called with a specific NavTag then the m_progressOnLivePath is set to the NavTag Exit whatever its position is.

Returns
ResetTrajectoryStatus indicates if ManualControl successfully ended or if Bot remains under ManualControl.

Hence, if the value is greater or equals to ResetTrajectoryStatus_Success, m_trajectory was successfully reset, ManualControl ends and m_trajectory will be updated each frame from now on.

Otherwise, the trajectory cannot be reset from the exit point, typically user can recompute a path or keep moving the Bot.

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).

const BotOutput & Kaim::Bot::GetBotOutput ( ) const
inline

Returns the output computed during last World::Update()

BaseNavigationProfile* Kaim::Bot::GetFollowedPathNavigationProfile ( )

Get the NavigationProfile of the currently followed Path.

const Vec2f & Kaim::Bot::GetFrontDirection ( ) const
inline

The moving direction from BotInput passed by the user.

NavTrianglePtr Kaim::Bot::GetNavTrianglePtr ( ) const
inline

Returns the triangle corresponding to SetPosition() into m_database.

const Vec3f & Kaim::Bot::GetPosition ( ) const
inline

The position from BotInput passed by the user.

const NavTag* Kaim::Bot::GetPreviousEventNavTag ( ) const

Returns a pointer to the navTag along the path before m_progressOnLivePath.

If positionOnLivePath is on a PathEvent, it returns the NavTag between this PathEvent and the previous.

Note: if positionOnLivePath is at the lower bound of the validity interval, it will return KY_NULL.

const Vec3f & Kaim::Bot::GetPreviousPosition ( ) const
inline

Returns the Bot position known at the previous World::Update. This can be used to achieve much more precise arrival detection and check point validation.

KyFloat32 Kaim::Bot::GetRemainingDistanceFromProgressToEndOfPath ( ) const

Return the remaining distance from the ProgressOnPath to the end of the followed path along the path.

It can return -1.f if there's no path or GetProgressOnLivePathStatus is not valid

const SpatializedCylinder & Kaim::Bot::GetSpatializedCylinder ( ) const
inline

The SpatializedCylinder used to spatialized the Bot in the bound Databases.

const NavTag* Kaim::Bot::GetUpcomingEventNavTag ( ) const

Returns a pointer to the navTag along the path after m_progressOnLivePath.

If positionOnLivePath is on a PathEvent, it returns the NavTag between this PathEvent and the next.

Note: if positionOnLivePath is at the upper bound of the validity interval, it will return KY_NULL.

const PositionOnPath* Kaim::Bot::GetUpcomingEventPositionOnPath ( ) const

Returns a pointer to the PositionOnPath of the PathEvent along the path after m_progressOnLivePath.

If m_progressOnLivePath is on a PathEvent, it returns the PositionOnPath of the next PathEvent.

Note: if positionOnLivePath is at the upper bound of the validity interval, it will return KY_NULL.

const Vec3f & Kaim::Bot::GetVelocity ( ) const
inline

The velocity vector from BotInput passed by the user.

bool Kaim::Bot::HasReachedPosition ( const Vec3f position,
KyFloat32  precisionRadius 
) const

The position is reached when the segment between a Bot previous and current position intersects the cylinder centered on the position with precisionRadius and database generation height.

void Kaim::Bot::Init ( const BotInitConfig initConfig)

uses a default constructed BotConfig

void Kaim::Bot::Init ( const BotInitConfig initConfig,
const BotConfig botConfig 
)

Initiates the Bot, but does not add it to the world.

If m_database is already set, Clear() is called to clean this instance up and prepare it for re-use.

KyResult Kaim::Bot::InitAStarQueryForBot ( Ptr< BaseAStarQuery > &  astarQuery,
const Vec3f destPos 
)

Initialize a BaseAStarQuery that works is properly initialized for the Bot.

This means calling BindToDatabase(), Initialize(start, dest), SetTraverseLogicUserData() and setting the SetComputeChannelMode, ChannelComputerConfig, PathFinderConfig.

KyResult Kaim::Bot::InitAStarQueryForBot ( Ptr< BaseAStarQuery > &  astarQuery,
const Vec3f destPos,
const NavGraphEdgePtr startNavGraphEdgePtr,
NavGraphEdgeDirection  navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL 
)

Initialize a BaseAStarQuery that works is properly initialized for the Bot.

This means calling BindToDatabase(), Initialize(start, dest), SetTraverseLogicUserData() and setting the SetComputeChannelMode, ChannelComputerConfig, PathFinderConfig.

void Kaim::Bot::InjectNewPath ( Path newPath)
inline

Set a new Path, considered as the path to follow, at the next World::Update.

Note : Your bot must not be computing a new path when this function is called. If it is, cancel the path computation before calling this function, to prevent the provided path from being overwritten by the path computation when it completes.

You can pass KY_NULL to end path following, but non-null paths with 0 nodes will be rejected.

bool Kaim::Bot::IsComputingNewPath ( ) const
inline

Call this method each time you want to compute a new Path.

If it returns true you must call ClearFollowedPath() before querying a new path computation (or wait for the previous query completion).

void Kaim::Bot::RemoveFromDatabase ( )

Removes the Bot from the Database (and thus from the World).

It is removed from the simulation, updates stop, and it is ignored by other 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::Bot::SetAvoidanceConfig ( const AvoidanceConfig avoidanceConfig)

The Trajectory will be recomputed after this call.

void Kaim::Bot::SetChannelComputerConfig ( const ChannelComputerConfig channelComputerConfig)

The path will not be recomputed after this call. The ChannelComputerConfig will be used by the next ComputeNewPathToDestination() calls.

void Kaim::Bot::SetColliderCollectorConfig ( const ColliderCollectorConfig colliderCollectorConfig)

The Trajectory will be recomputed the frame after this call.

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::Bot::SetDoComputeProgressOnPath ( bool  doUpdateProgressOnPath)

When set to true, m_progressOnLivePath will be automatically updated in Bot::UpdatePathFollowing() based on a geometric criterion which is the bot crossing bisector line or plane (if in NavMesh or not) of the path edges.

When set to false, it is the user's responsibility to move it forward properly, m_progressOnLivePath's positionOnPath won't be updated at all! Beware to check GetProgressOnPathStatus(), this status will be maintained to let the user know if m_progressOnLivePath is totally invalidated.

You can set this to false when the Bot enters a specific NavTag associated with a custom movement you want to control on your side (ex for SmartObjects: foors, ladders...) and that you want to get have m_progressOnLivePath to move accordingly to your logic instead of the geometrical criterion.

Set to true by default.

void Kaim::Bot::SetDoComputeTrajectory ( bool  doComputeTrajectory)

When set to false, the Bot will no more compute the Trajectory.

You can set this to false typically when the Bot enters a specific NavTag associated with a custom movement you want to control on your side (ex for SmartObjects: foors, ladders...).

Set to true by default.

void Kaim::Bot::SetDoValidateCheckPoint ( bool  doValidateCheckPoint)
inline

When set to true, the Bot ProgressOnPath will be block at PathEvent CheckPoints until the IPositionOnPathValidator instance of the NavigationPofile returns true.

When set to false, the Bot will ignore PathEvent CheckPoints.

You can set this to false typically when the Bot enters a specific NavTag associated with a custom movement you want to control on your side (ex for SmartObjects: foors, ladders...).

However, the ProgressOnPath is still computed in order to keep track of the progression on the path if m_doComputeProgressOnPath.

Set to true by default.

void Kaim::Bot::SetEnableAvoidance ( bool  enable)

EnableAvoidance impacts the Trajectory, the Trajectory will be recomputed after this call.

void Kaim::Bot::SetForceMinimizedSpatializationCoherency ( bool  forceMinimalCoherency)
inline

By default, Spatialization coherency is maximized, you can force minimization here.

i.e. in order to maximized spatialization coherency, finding the Bot's new triangle is done based on the current triangle in a continuous manner with large altitude range (using Database::GetPositionSpatialisationRange()), this is the proper way to spatialized a Bot following a Path edge on NavMesh as expected.

However, when following a Path edge out of NavMesh, particularly when going from NavMesh to NavMesh in a discontinuous manner e.g. transitioning from a floor to another floor via a graph, it is preferable not to favor triangles of the original floor, in that case the spatialization coherency is automatically minimized (the Bot SpatializationRange is reduced) So, it can be useful to call SetForceMinimizedSpatializationCoherency(true) temporarily to manually force minimization of spatialization coherency,

void Kaim::Bot::SetFrontDirection ( const Vec2f frontDirection)
inline

Optional: your entities might face a direction that is different from the velocity.

The frontDirection is expected to be a normalized vector.

void Kaim::Bot::SetHeight ( KyFloat32  height)

Height is only used to send the correct visualDebug.

void Kaim::Bot::SetLocalCostOnPathDistance ( KyFloat32  localCostOnPathDistance)
inline

Set the distance along the path from the ProgressOnPath used to compute the local maximum cost multiplier on path.

cf AdvancedPathProgressConfig::m_localMaxCostMultiplierOnPathDistance

void Kaim::Bot::SetMaxDesiredLinearSpeed ( KyFloat32  maxDesiredLinearSpeed)

The Trajectory will be recomputed the frame after this call.

void Kaim::Bot::SetNewPathNavigationProfileId ( KyUInt32  navigationProfileId)
inline

Sets the NavigationProfile that will be used in the new ComputeNewPathToDestination() and InitAStarQuery() calls.

SetNewPathToDestNavigationProfile() does not compute any new path, an explicit call to ComputeNewPathToDestination() is necessary.

void Kaim::Bot::SetPathFinderConfig ( const PathFinderConfig pathFinderConfig)

The Path will not be recomputed after this call. The PathFinderConfig will be used by the next ComputeNewPathToDestination() calls.

void Kaim::Bot::SetPathProgressConfig ( const PathProgressConfig pathProgressConfig)

The PathProgressConfig::m_pathValidationDistanceMinBackward and PathProgressConfig::m_pathValidationMinDistanceForward impact the computation of the events on the Path.

The PathEventList will be recomputed the frame after this call.

void Kaim::Bot::SetPosition ( const Vec3f position)
inline

As Gameware Navigation never moves a bot, call this function to update the Bot position.

It will also back up the position at World::Update into m_previousPosition

void Kaim::Bot::SetPositionAndVelocity ( const Vec3f position,
KyFloat32  simulationTimeInSeconds 
)
inline

For convenience, deduce velocity from previous position.

void Kaim::Bot::SetPositionAndVelocityAndFrontDirection ( const Vec3f position,
KyFloat32  simulationTimeInSeconds 
)
inline

For convenience, set position and deduce velocity from previous position as well as frontDirection.

void Kaim::Bot::SetRadius ( KyFloat32  radius)

Radius only impacts other surrounding bots avoidance.

If avoidance is computed every frame, there is nothing to do.

If avoidance is computed some time to time then avoidance computation of all surrounding bots should theorically be re-computed next frame.

void Kaim::Bot::SetShortcutTrajectoryConfig ( const ShortcutTrajectoryConfig shortcutTrajectoryConfig)

The Trajectory will be recomputed the frame after this call.

void Kaim::Bot::SetSplineTrajectoryConfig ( const SplineTrajectoryConfig splineTrajectoryConfig)

The Trajectory will be recomputed the frame after this call.

void Kaim::Bot::SetTrajectoryFailureMode ( TrajectoryFailureMode  trajectoryFailureMode)
inline

Set the TrajectoryFailureMode, nothing in particular will be recomputed after this call.

void Kaim::Bot::SetTrajectoryMinimalMoveDistance ( KyFloat32  trajectoryMinimalMoveDistance)
inline

Set the Bot TrajectoryMinimalMoveDistance (cf BotConfig::m_trajectoryMinimalMoveDistance), nothing in particular will be recomputed after this call.

void Kaim::Bot::SetTrajectoryMode ( TrajectoryMode  trajectoryMode)

Trajectory will be recomputed the frame after this call.

If the trajectory mode switches from TrajectoryMode_Shortcut to TrajectoryMode_Spline, this requires a path recompute that needs to be called explicitly by the user.

void Kaim::Bot::SetVelocity ( const Vec3f velocity)
inline

The actual velocity of your entity might differ from the one we gave you in the trajectory because of physics, animation, gameplay...

We use this velocity for avoidance purposes.

The velocity must include the speed in meters per seconds.

void Kaim::Bot::SetVelocityAndFrontDirection ( const Vec3f velocity)
inline

For convenience, set velocity and deduce frontDirection from it.


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