32 class BaseNavigationProfile;
33 class BasePathProgressComputer;
35 class IPathEventListObserver;
36 class IMovePositionOnLivePathPredicate;
37 class IPathFinderQuery;
39 class SplineInputBlobDumpConfig;
40 class DisplayListManager;
55 bool IsPathRecomputationNeeded()
const;
56 UpperBoundType GetUpperBoundType()
const;
62 Vec3f m_outputVelocity;
63 Vec2f m_outputFrontDirection;
115 Vec3f m_startPosition;
116 Vec3f m_startVelocity;
117 Vec2f m_startFrontDirection;
137 virtual const char* GetTypeName()
const {
return "Bot"; }
226 const ChannelSectionPtr& GetChannelSectionPtr()
const {
return m_positionInChannel; }
228 Database* GetDatabase()
const {
return m_database; }
229 IPathFinderQuery* GetPathFinderQuery() {
return m_pathFinderQuery; }
230 BasePathProgressComputer* GetPathProgressComputer()
const {
return m_pathProgressComputer; }
231 Trajectory* GetTrajectory()
const {
return m_trajectory; }
233 const PositionOnLivePath& GetProgressOnLivePath()
const {
return m_progressOnLivePath; }
241 const BotConfig& GetConfig()
const {
return *m_botConfig; }
255 KyFloat32 GetRadius()
const {
return m_botConfig->m_radius; }
259 KyFloat32 GetHeight()
const {
return m_botConfig->m_height; }
267 TrajectoryMode GetTrajectoryMode()
const {
return m_botConfig->m_trajectoryMode; }
273 const PathFinderConfig& GetPathFinderConfig()
const {
return m_botConfig->m_pathFinderConfig; }
277 const ChannelComputerConfig& GetChannelComputerConfig()
const {
return m_botConfig->m_channelComputerConfig; }
284 const PathProgressConfig& GetPathProgressConfig()
const {
return m_botConfig->m_pathProgressConfig; }
290 KyFloat32 GetMaxDesiredLinearSpeed()
const {
return m_botConfig->m_maxDesiredLinearSpeed; }
294 TrajectoryFailureMode GetTrajectoryFailureMode()
const {
return m_botConfig->m_trajectoryFailureMode; }
298 const ShortcutTrajectoryConfig& GetShortcutTrajectoryConfig()
const {
return m_botConfig->m_shortcutTrajectoryConfig; }
302 const SplineTrajectoryConfig& GetSplineTrajectoryConfig()
const {
return m_botConfig->m_splineTrajectoryConfig; }
308 bool GetEnableAvoidance()
const {
return m_botConfig->m_enableAvoidance; }
312 const ColliderCollectorConfig& GetColliderCollectorConfig()
const {
return m_botConfig->m_colliderCollectorConfig; }
316 const AvoidanceConfig& GetAvoidanceConfig()
const {
return m_botConfig->m_avoidanceConfig; }
322 KyFloat32 GetTrajectoryMinimalMoveDistance()
const {
return m_botConfig->m_trajectoryMinimalMoveDistance; }
327 KyFloat32 GetLocalMaxCostMultiplierOnPathDistance()
const {
return m_botConfig->m_pathProgressConfig.m_advancedConfig.m_localMaxCostMultiplierOnPathDistance; }
338 KyUInt32 GetNewPathNavigationProfileId()
const {
return m_newPathToDestNavigationProfileId; }
351 KyResult ComputeAStarQueryAsync(
const Vec3f& destPos,
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL,
352 const PathFinderConfig* pathFinderConfig =
nullptr);
358 Ptr<BaseAStarQuery>
GetAStarQuery() {
return m_botNavigationCollection.GetOrCreateAStarQuery(m_newPathToDestNavigationProfileId); }
371 const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL,
399 void* GetBotTraverseLogicUserData()
const {
return m_traverseLogicUserData; }
400 void SetBotTraverseLogicUserData(
void* traverseLogicUserData) { m_traverseLogicUserData = traverseLogicUserData; }
404 const LivePath& GetLivePath()
const {
return m_livePath; }
405 const PathEventList& GetPathEventList()
const {
return m_livePath.GetPathEventList(); }
406 const PathValidityInterval& GetPathValidityInterval()
const {
return m_livePath.m_validityInterval; }
407 Path* GetFollowedPath()
const {
return m_livePath.GetFollowedPath(); }
408 PathSource GetFollowedPathSource()
const {
return m_livePath.GetFollowedPathSource(); }
409 ChannelArray* GetChannelArray()
const {
return m_livePath.GetChannelArray(); }
455 bool GetDoComputeProgressOnPath()
const {
return m_doComputeProgressOnPath; }
465 bool GetDoValidateCheckPoint()
const {
return m_doValidateCheckPoint; }
472 bool GetDoComputeTrajectory()
const {
return m_doComputeTrajectory; }
473 void ForceRecomputeTrajectory();
481 bool IsBlocking()
const;
493 template<
class TraverseLogic>
549 bool GetForceMinimizedSpatializationCoherency()
const {
return m_forceMinimizedSpatializationCoherency; }
553 void UpdatePathFollowing(
KyFloat32 simulationTimeInSeconds);
555 void ComputeTrajectory(
KyFloat32 simulationTimeInSeconds);
561 virtual void DoSendVisualDebug(VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent);
564 void UpdateSpatialization();
566 void SetupTagVolumeInitConfig(TagVolumeInitConfig& tagVolumeInitConfig);
567 void OnTagVolumeIntegration();
568 void OnTagVolumeDeIntegration();
570 DatabaseBinding* GetDatabaseBinding();
573 LivePath& GetLivePath() {
return m_livePath; }
574 PathEventList& GetPathEventList() {
return m_livePath.GetPathEventList(); }
577 void ComputeBotRadiusAndHeight();
584 KY_DEPRECATED(
const ChannelComputerConfig& GetChannelComputerConfigConfig()
const) {
return GetChannelComputerConfig(); }
585 KY_DEPRECATED(
KyResult InitAStarQueryForBot(Ptr<BaseAStarQuery>& astarQuery,
const Vec3f& destPos,
const PathFinderConfig* pathFinderConfig =
nullptr)) {
return InitAStarQuery(astarQuery, destPos, pathFinderConfig); }
586 KY_DEPRECATED(
KyResult InitAStarQueryForBot(Ptr<BaseAStarQuery>& astarQuery,
const Vec3f& destPos,
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL,
const PathFinderConfig* pathFinderConfig =
nullptr)) {
return InitAStarQuery(astarQuery, destPos, startNavGraphEdgePtr, navGraphEdgePathfindMode, pathFinderConfig); }
588 KY_DEPRECATED(
KyResult ComputeNewPathToDestination(
const Vec3f& destPos,
const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL,
const PathFinderConfig* pathFinderConfig =
nullptr)) {
return ComputeAStarQueryAsync(destPos, startNavGraphEdgePtr, navGraphEdgePathfindMode, pathFinderConfig); }
592 KY_DEPRECATED(
bool CanAcceptNewPathComputation()) {
return CanAcceptNewPath(); }
599 bool CanAcceptNewPath();
600 void ClearPathFindingAndFollowingStates();
601 void SetupBotRadiusCappedToGenerationMetrics();
602 void SetupBotHeightCappedToGenerationMetrics();
603 void SendPathFinderErrorDisplayList();
604 void ReplaceFollowedPathWithNewPath();
605 void SetTrajectory(Trajectory* trajectory);
608 SpatializationUpdateCoherency GetSpatializationUpdateCoherency()
const;
609 void UpdateBotPositionSpatializationButNotFloors()
const;
612 Database* m_database;
613 void* m_traverseLogicUserData;
615 Ptr<IPathFinderQuery> m_pathFinderQuery;
618 Ptr<BasePathProgressComputer> m_pathProgressComputer;
619 Ptr<Trajectory> m_trajectory;
623 SpatializedCylinder m_spatializedCylinder;
624 ChannelSectionPtr m_positionInChannel;
625 PositionOnLivePath m_progressOnLivePath;
627 Vec3f m_previousPosition;
628 ManualControlInterval m_manualControlInterval;
629 KyFloat32 m_localMaxCostMultiplierOnPath;
634 Vec2f m_frontDirection;
637 BotOutput m_botOutput;
640 KyUInt32 m_newPathToDestNavigationProfileId;
641 BotNavigationCollection m_botNavigationCollection;
644 mutable BotNeedFullComputeFlags m_botNeedFullComputeFlags;
647 Vec3f m_lastCollectorPosition;
648 Ptr<QueryDynamicOutput> m_collectorOutput;
654 Ptr<BotConfig> m_botConfig;
656 bool m_forceMinimizedSpatializationCoherency;
660 mutable PointSpatialization m_positionSpatialization;
663 DynamicNavTag m_blockingNavTag;
664 TagVolumeTrigger<Bot> m_tagVolumeTrigger;
666 bool m_doComputeProgressOnPath;
667 bool m_doValidateCheckPoint;
668 bool m_doComputeTrajectory;
671 BotVisualDebug m_visualDebug;
674 Ptr<SplineInputBlobDumpConfig> m_advancedDebug_InputBlobDumpConfig;
const Vec3f & GetPreviousPosition() const
Returns the Bot position known at the previous World::Update.
Definition: bot.h:223
BaseNavigationProfile and its derivation NavigationProfile is a class that simplifies ...
Definition: basenavigationprofile.h:28
This class is the world element that represent an active character in Autodesk Navigation.
Definition: bot.h:128
TrajectoryMode
Enum that defines the 2 possible Trajectory modes.
Definition: botconfig.h:26
Base class for all pathfinder queries.
Definition: ipathfinderquery.h:34
KyFloat32 GetRemainingDistanceFromProgressToEndOfPath() const
Return the remaining distance from the ProgressOnPath to the end of the followed path along the path...
Definition: bot.cpp:287
void SetShortcutTrajectoryConfig(const ShortcutTrajectoryConfig &shortcutTrajectoryConfig)
The Trajectory will be recomputed the frame after this call.
Definition: bot.cpp:716
void SetDoComputeProgressOnPath(bool doUpdateProgressOnPath)
When set to true, m_progressOnLivePath will be automatically updated in Bot::UpdatePathFollowing() ba...
Definition: bot.cpp:862
This class aggregates all necessary information about a position on a Path.
Definition: positiononpath.h:29
void SetDoValidateCheckPoint(bool doValidateCheckPoint)
When set to true, the Bot ProgressOnPath will be block at PathEvent CheckPoints until the IPositionOn...
Definition: bot.inl:50
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
void SetEnableAvoidance(bool enable)
EnableAvoidance impacts the Trajectory, the Trajectory will be recomputed after this call...
Definition: bot.cpp:674
static Vec2f UnitX()
Returns {1.0f, 0.0f}.
Definition: vec2f.h:97
void SetMaxDesiredLinearSpeed(KyFloat32 maxDesiredLinearSpeed)
The Trajectory will be recomputed the frame after this call.
Definition: bot.cpp:647
Ptr< BaseAStarQuery > GetAStarQuery()
These functions should be used for advanced path finding scenarios.
Definition: bot.h:358
void SetVelocity(const Vec3f &velocity)
The actual velocity of your entity might differ from the one we gave you in the trajectory because of...
Definition: bot.inl:99
void SetPositionAndVelocity(const Vec3f &position, KyFloat32 simulationTimeInSeconds)
For convenience, deduce velocity from previous position.
Definition: bot.inl:111
TrajectoryFailureMode
Enum that defines the 2 possible behaviors in case the Trajectory cannot follow the path e...
Definition: botconfig.h:34
void SetDoComputeTrajectory(bool doComputeTrajectory)
When set to false, the Bot will no more compute the Trajectory.
Definition: bot.cpp:875
KyResult InitAStarQuery(Ptr< BaseAStarQuery > &astarQuery, const Vec3f &destPos, const PathFinderConfig *pathFinderConfig=nullptr)
Initialize a BaseAStarQuery for the Bot, not that the query must use the same TraverseLogic than your...
Definition: bot.cpp:543
DisplayListManager * GetDisplayListManager() const
Get the DisplayListManager that is required when creating a DisplayList.
Definition: bot.cpp:244
void SetLocalMaxCostMultiplierOnPathDistance(KyFloat32 localMaxCostMultiplierOnPathDistance)
Set the distance along the path from the ProgressOnPath used to compute the local maximum cost multip...
Definition: bot.cpp:668
void AddToDatabase()
Adds the Bot to the Database (and thus to the World).
Definition: bot.cpp:183
void SetTrajectoryMode(TrajectoryMode trajectoryMode)
Trajectory will be recomputed the frame after this call.
Definition: bot.cpp:637
KyResult ComputeAStarQueryAsync(const Vec3f &destPos, const PathFinderConfig *pathFinderConfig=nullptr)
Launches an asynchronous path computation from the Bot position to destPos.
Definition: bot.inl:33
void SetBlocking(bool isBlocking)
Trigger a TagVolume integration or deintegration.
Definition: bot.inl:66
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
Database * m_database
Mandatory: you must provide a valid Database on which the Bot will move.
Definition: bot.h:106
ProgressOnPathStatus
Enumerates the possible status values of Bot Position on path.
Definition: progressonpathstatus.h:13
const Vec3f & GetPosition() const
The position from BotInput passed by the user.
Definition: bot.h:215
Vec3f ComputeMoveOnNavMesh(const Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
returns true as long as SetBlocking(true) was called or the integrated TagVolume has not be deintegra...
Definition: bot.cpp:897
void SetFrontDirection(const Vec2f &frontDirection)
Optional: your entities might face a direction that is different from the velocity.
Definition: bot.inl:100
KyResult InjectPath(Path *newPath)
Set a new Path, considered as the path to follow, at the next World::Update.
Definition: bot.inl:21
NavTrianglePtr GetNavTrianglePtr() const
Returns the triangle corresponding to SetPosition() into m_database.
Definition: bot.h:225
AvoidanceResult
Enumerates the possible results of a call to IAvoidanceComputer::Compute().
Definition: iavoidancecomputer.h:18
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:132
BotOutput gathers the most important outputs of a bot for easy access.
Definition: bot.h:43
KyResult ComputePathAsync(IPathFinderQuery *pathFinderQuery)
Launches a new path computation with a pathFinderQuery.
Definition: bot.inl:38
void SetAvoidanceConfig(const AvoidanceConfig &avoidanceConfig)
The Trajectory will be recomputed after this call.
Definition: bot.cpp:748
KyUInt32 m_startNewPathNavigationProfileId
NavigationProfile that will be used in the GetAstarQuery() calls.
Definition: bot.h:113
void SetColliderCollectorConfig(const ColliderCollectorConfig &colliderCollectorConfig)
The Trajectory will be recomputed the frame after this call.
Definition: bot.cpp:737
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
2d vector using KyFloat32.
Definition: vec2f.h:18
PathSource
Enumerates the possible source for a new Path.
Definition: livepath.h:39
void SetTrajectoryMinimalMoveDistance(KyFloat32 trajectoryMinimalMoveDistance)
Set the Bot TrajectoryMinimalMoveDistance (cf BotConfig::m_trajectoryMinimalMoveDistance), nothing in particular will be recomputed after this call.
Definition: bot.cpp:662
void SetRadius(KyFloat32 radius)
Radius only impacts other surrounding bots avoidance.
Definition: bot.cpp:622
void SetPositionAndVelocityAndFrontDirection(const Vec3f &position, KyFloat32 simulationTimeInSeconds)
For convenience, set position and deduce velocity from previous position as well as frontDirection...
Definition: bot.inl:102
void CancelComputePathAsync()
Cancel the current path computation.
Definition: bot.h:389
#define KY_DEPRECATED(expr)
The compiler issues a warning when a deprecated function or typedef is used.
Definition: types.h:93
Navigation return code class.
Definition: types.h:108
void ForceValidityIntervalRecompute()
Call this method to force an update of the PathValidityInterval.
Definition: livepath.inl:35
BaseNavigationProfile * GetFollowedPathNavigationProfile()
Get the NavigationProfile of the currently followed Path.
Definition: bot.cpp:853
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:13
ResetTrajectoryStatus ExitManualControl()
If EnterManualControl() was called without NavTag then the current m_progressOnLivePath is used...
Definition: bot.cpp:916
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:41
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
ManualControlStatus EnterManualControl()
Following function helps setting up the PathFollowing when user wants to take control of the Bot Thes...
Definition: bot.cpp:902
Ptr< DatabaseBinding > m_databaseBinding
The Databases where the Bot will be spatialized.
Definition: bot.h:110
Class that aggregates most important parameters that allow to configure the PathFinding of a Bot...
Definition: pathfinderconfig.h:19
Class used to provide Bot initialization parameters.
Definition: bot.h:76
bool IsComputingNewPath() const
Returns true if a path computation has been launched with the PathFinderQuery and the followed path h...
Definition: livepath.inl:31
void SetNewPathNavigationProfileId(KyUInt32 navigationProfileId)
These functions are used to have the bot finding a Path very easily by only providing your AstarQuery...
Definition: bot.h:337
const SpatializedCylinder & GetSpatializedCylinder() const
The SpatializedCylinder used to spatialiazed the Bot in the bound Databases.
Definition: bot.h:219
Internal representation of world elements, using a vertical cylinder shape.
Definition: spatializedcylinder.h:44
void SetPathFinderConfig(const PathFinderConfig &pathFinderConfig)
The Path will not be recomputed after this call. The PathFinderConfig will be used by the next Comput...
Definition: bot.cpp:684
static Vec2f Zero()
Returns {0.0f, 0.0f}.
Definition: vec2f.h:93
void RemoveFromDatabase()
Removes the Bot from the Database (and thus from the World).
Definition: bot.cpp:196
const NavTag * GetUpcomingEventNavTag() const
Returns a pointer to the navTag along the path after m_progressOnLivePath.
Definition: bot.cpp:303
void ClearFollowedPath()
Clears the current LivePath and associated events.
Definition: bot.cpp:257
const BotOutput & GetBotOutput() const
Returns the output computed during last World::Update()
Definition: bot.h:210
VisualDebugServer * GetVisualDebugServer() const
Get the VisualDebugServer.
Definition: bot.cpp:249
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:17
Class that aggregates all parameters that allow to configure the PathFinding and the PathFollowing of...
Definition: botconfig.h:37
void SetSplineTrajectoryConfig(const SplineTrajectoryConfig &splineTrajectoryConfig)
The Trajectory will be recomputed the frame after this call.
Definition: bot.cpp:726
const PositionOnPath * GetUpcomingEventPositionOnPath() const
Returns a pointer to the PositionOnPath of the PathEvent along the path after m_progressOnLivePath.
Definition: bot.cpp:298
DynamicNavTag m_blockingNavTag
NavTag used for the TagVolume triggered if Bot::SetBlocking(true) is called.
Definition: bot.h:123
void SetDefaults()
Sets all members to their default value.
Definition: bot.h:88
void SetPathProgressConfig(const PathProgressConfig &pathProgressConfig)
The PathProgressConfig::m_pathValidationDistanceMinBackward and PathProgressConfig::m_pathValidationM...
Definition: bot.cpp:703
void SetTrajectoryFailureMode(TrajectoryFailureMode trajectoryFailureMode)
Set the TrajectoryFailureMode, nothing in particular will be recomputed after this call...
Definition: bot.cpp:656
DestructionPurpose
Explains the reason the PathEventList is about to be destroyed.
Definition: ipatheventlistobserver.h:59
void Init(const BotInitConfig &initConfig)
uses a default constructed BotConfig
Definition: bot.cpp:87
bool IsComputingPath() const
Call this method each time you want to compute a new Path.
Definition: bot.h:394
void SetVelocityAndFrontDirection(const Vec3f &velocity)
For convenience, set velocity and deduce frontDirection from it.
Definition: bot.inl:120
ManualControlStatus
Definition: manualcontrolinterval.h:17
const Vec3f & GetVelocity() const
The velocity vector from BotInput passed by the user.
Definition: bot.h:217
bool HasReachedPosition(const Vec3f &position, KyFloat32 precisionRadius) const
The position is reached when the segment between a Bot previous and current position intersects the c...
Definition: bot.cpp:316
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:20
void SetHeight(KyFloat32 height)
Height is only used to send the correct visualDebug.
Definition: bot.cpp:630
const Vec2f & GetFrontDirection() const
The moving direction from BotInput passed by the user.
Definition: bot.h:216
void Clear()
Prepares this instance for destruction and / or reuse: sets all members to their default values and c...
Definition: bot.cpp:145
Vec3f ComputeMoveOnNavMeshWithTraverseLogic(const Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
Helper function to compute the position the bot would reach if you apply the velocity for simulationT...
Definition: bot.inl:53
The class representing a path.
Definition: path.h:62
void SetPosition(const Vec3f &position)
These methods have to be called to update Bot position, velocity and front direction.
Definition: bot.inl:91
float KyFloat32
float
Definition: types.h:32
const NavTag * GetPreviousEventNavTag() const
Returns a pointer to the navTag along the path before m_progressOnLivePath.
Definition: bot.cpp:308
3d vector using 32bits floating points.
Definition: vec3f.h:16
ResetTrajectoryStatus
Definition: resettrajectorystatus.h:13
void SetChannelComputerConfig(const ChannelComputerConfig &channelComputerConfig)
The path will not be recomputed after this call. The ChannelComputerConfig will be used by the next C...
Definition: bot.cpp:693
void SetForceMinimizedSpatializationCoherency(bool forceMinimizeCoherency)
By default, Spatialization coherency is maximized, you can force minimization here.
Definition: bot.h:548