8 #ifndef Navigation_Bot_H
9 #define Navigation_Bot_H
35 class BaseNavigationProfile;
36 class BasePathProgressComputer;
38 class IPathEventListObserver;
39 class IMovePositionOnLivePathPredicate;
40 class IPathFinderQuery;
42 class SplineInputBlobDumpConfig;
57 bool IsPathRecomputationNeeded()
const;
58 UpperBoundType GetUpperBoundType()
const;
64 Vec3f m_outputVelocity;
65 Vec2f m_outputFrontDirection;
114 Vec3f m_startPosition;
116 Vec2f m_startFrontDirection;
130 virtual const char* GetTypeName()
const {
return "Bot"; }
218 const ChannelSectionPtr& GetChannelSectionPtr()
const;
276 KyFloat32 GetMaxDesiredLinearSpeed()
const;
294 bool GetEnableAvoidance()
const;
308 KyFloat32 GetTrajectoryMinimalMoveDistance()
const;
313 KyFloat32 GetLocalCostOnPathDistance()
const;
324 KyUInt32 GetNewPathNavigationProfileId()
const;
352 const NavGraphEdgePtr& startNavGraphEdgePtr, NavGraphEdgeDirection navGraphEdgePathfindMode = NAVGRAPHEDGE_BIDIRECTIONAL);
357 void* GetBotTraverseLogicUserData()
const;
358 void SetBotTraverseLogicUserData(
void* traverseLogicUserData);
389 const LivePath& GetLivePath()
const;
392 Path* GetFollowedPath()
const;
440 bool GetDoComputeProgressOnPath()
const;
450 bool GetDoValidateCheckPoint()
const;
457 bool GetDoComputeTrajectory()
const;
458 void ForceRecomputeTrajectory();
471 template<
class TraverseLogic>
527 bool GetForceMinimizedSpatializationCoherency()
const;
531 void UpdatePathFollowing(
KyFloat32 simulationTimeInSeconds);
533 void ComputeTrajectory(
KyFloat32 simulationTimeInSeconds);
539 virtual void DoSendVisualDebug(
VisualDebugServer& server, VisualDebugSendChangeEvent changeEvent);
542 void UpdateSpatialization();
547 void FlagPathAsPotentiallyDirty();
549 void ComputeBotRadiusAndHeight();
555 KY_DEPRECATED(
bool GetDoMaximizeSpatializationCoherency()) {
return !GetForceMinimizedSpatializationCoherency(); }
559 void ResetPathFindingAndFollowingStates();
560 void SetupBotRadiusCappedToGenerationMetrics();
561 void SetupBotHeightCappedToGenerationMetrics();
562 void SendPathFinderErrorDisplayList();
563 void ReplaceFollowedPathWithNewPath();
564 void SetTrajectory(Trajectory* trajectory);
566 SpatializationUpdateCoherency GetSpatializationUpdateCoherency()
const;
567 PointSpatialization& GetPositionSpatialization()
const;
571 bool IsShortcutTrajectoryAllowingToSkipPathFollowingThisFrame(
KyFloat32& simulationTimeInSecondsToApplyThisFrame);
574 Database* m_database;
575 void* m_traverseLogicUserData;
577 Ptr<IPathFinderQuery> m_pathFinderQuery;
580 Ptr<BasePathProgressComputer> m_pathProgressComputer;
581 Ptr<Trajectory> m_trajectory;
585 SpatializedCylinder m_spatializedCylinder;
586 ChannelSectionPtr m_positionInChannel;
587 PositionOnLivePath m_progressOnLivePath;
589 Vec3f m_previousPosition;
590 ManualControlInterval m_manualControlInterval;
591 KyFloat32 m_localMaxCostMultiplierOnPath;
596 Vec2f m_frontDirection;
599 BotOutput m_botOutput;
602 KyUInt32 m_newPathToDestNavigationProfileId;
603 BotNavigationCollection m_botNavigationCollection;
606 mutable BotNeedFullComputeFlags m_botNeedFullComputeFlags;
609 Vec3f m_lastCollectorPosition;
610 Ptr<QueryDynamicOutput> m_collectorOutput;
616 Ptr<BotConfig> m_botConfig;
618 bool m_forceMinimizedSpatializationCoherency;
621 mutable PointSpatialization m_positionSpatialization;
623 bool m_doComputeProgressOnPath;
624 bool m_doValidateCheckPoint;
625 bool m_doComputeTrajectory;
628 BotVisualDebug m_visualDebug;
631 Ptr<SplineInputBlobDumpConfig> m_advancedDebug_InputBlobDumpConfig;
638 #endif // Navigation_Bot_H
BaseNavigationProfile and its derivation NavigationProfile is a class that simplifies ...
Definition: basenavigationprofile.h:34
void ComputeNewPathAsync(IPathFinderQuery *pathFinderQuery)
Launches a new path computation with a pathFinderQuery.
Definition: bot.inl:73
void SetForceMinimizedSpatializationCoherency(bool forceMinimalCoherency)
By default, Spatialization coherency is maximized, you can force minimization here.
Definition: bot.inl:24
This class is the world element that represent an active character in Gameware Navigation.
Definition: bot.h:150
TrajectoryMode
Enum that defines the 2 possible trajectories modes.
Definition: botconfig.h:31
Base class for all pathfinder queries.
Definition: ipathfinderquery.h:38
KyFloat32 GetRemainingDistanceFromProgressToEndOfPath() const
Return the remaining distance from the ProgressOnPath to the end of the followed path along the path...
void SetShortcutTrajectoryConfig(const ShortcutTrajectoryConfig &shortcutTrajectoryConfig)
The Trajectory will be recomputed the frame after this call.
const Vec3f & GetPreviousPosition() const
Returns the Bot position known at the previous World::Update. This can be used to achieve much more p...
Definition: bot.inl:137
Set of parameters used to configure AvoidanceComputer.
Definition: avoidanceconfig.h:117
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
void SetDoComputeProgressOnPath(bool doUpdateProgressOnPath)
When set to true, m_progressOnLivePath will be automatically updated in Bot::UpdatePathFollowing() ba...
This class aggregates all necessary information about a position on a Path, namely: ...
Definition: positiononpath.h:33
const Vec2f & GetFrontDirection() const
The moving direction from BotInput passed by the user.
Definition: bot.inl:130
PathEventList aggregates all PathEvents and PathEventIntervals in a PathValidityInterval.
Definition: patheventlist.h:141
void SetDoValidateCheckPoint(bool doValidateCheckPoint)
When set to true, the Bot ProgressOnPath will be block at PathEvent CheckPoints until the IPositionOn...
Definition: bot.inl:75
Class that configures how the Bot collects colliders (other bots, obstacles) around.
Definition: collidercollectorconfig.h:19
void SetEnableAvoidance(bool enable)
EnableAvoidance impacts the Trajectory, the Trajectory will be recomputed after this call...
static Vec2f UnitX()
Returns the normalized orientation of the X axis.
Definition: vec2f.h:157
void SetMaxDesiredLinearSpeed(KyFloat32 maxDesiredLinearSpeed)
The Trajectory will be recomputed the frame after this call.
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:101
void SetPositionAndVelocity(const Vec3f &position, KyFloat32 simulationTimeInSeconds)
For convenience, deduce velocity from previous position.
Definition: bot.inl:113
Class that aggregates parameters that allow to configure the progress of a Bot on its path...
Definition: pathprogressconfig.h:62
BaseNavigationProfile * GetFollowedPathNavigationProfile()
Get the NavigationProfile of the currently followed Path.
TrajectoryFailureMode
Enum that defines the 2 possible behaviors in case Trajectory cannot follow the path e...
Definition: botconfig.h:43
void SetDoComputeTrajectory(bool doComputeTrajectory)
When set to false, the Bot will no more compute the Trajectory.
Class that aggregates parameters that allow to configure the channel computation of a Bot...
Definition: channelcomputerconfig.h:76
const Vec3f & GetPosition() const
The position from BotInput passed by the user.
Definition: bot.inl:129
void AddToDatabase()
Adds the Bot to the Database (and thus to the World).
void SetTrajectoryMode(TrajectoryMode trajectoryMode)
Trajectory will be recomputed the frame after this call.
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
This class aggregates Channels along a Path.
Definition: channelarray.h:31
Database * m_database
Mandatory: you must provide a valid Database on which the Bot will move.
Definition: bot.h:134
ProgressOnPathStatus
Enumerates the possible status values of Bot Position on path.
Definition: progressonpathstatus.h:14
void InjectNewPath(Path *newPath)
Set a new Path, considered as the path to follow, at the next World::Update.
Definition: bot.inl:64
void SetFrontDirection(const Vec2f &frontDirection)
Optional: your entities might face a direction that is different from the velocity.
Definition: bot.inl:102
NavTrianglePtr GetNavTrianglePtr() const
Returns the triangle corresponding to SetPosition() into m_database.
Definition: bot.inl:136
AvoidanceResult
Enumerates the possible results of a call to IAvoidanceComputer::Compute().
Definition: iavoidancecomputer.h:20
BotOutput gathers the most important outputs of a bot for easy access.
Definition: bot.h:45
Class that configures how the trajectory is computed from the Channel.
Definition: splinetrajectoryconfig.h:31
void SetAvoidanceConfig(const AvoidanceConfig &avoidanceConfig)
The Trajectory will be recomputed after this call.
KyUInt32 m_startNewPathNavigationProfileId
NavigationProfile that will be used in the ComputeNewPathToDestination() calls.
Definition: bot.h:141
void SetColliderCollectorConfig(const ColliderCollectorConfig &colliderCollectorConfig)
The Trajectory will be recomputed the frame after this call.
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:64
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
const NavTag * GetUpcomingEventNavTag() const
Returns a pointer to the navTag along the path after m_progressOnLivePath.
PathSource
Enumerates the possible source for a new Path.
Definition: livepath.h:44
void SetTrajectoryMinimalMoveDistance(KyFloat32 trajectoryMinimalMoveDistance)
Set the Bot TrajectoryMinimalMoveDistance (cf BotConfig::m_trajectoryMinimalMoveDistance), nothing in particular will be recomputed after this call.
Definition: bot.inl:52
void SetRadius(KyFloat32 radius)
Radius only impacts other surrounding bots avoidance.
void SetPositionAndVelocityAndFrontDirection(const Vec3f &position, KyFloat32 simulationTimeInSeconds)
For convenience, set position and deduce velocity from previous position as well as frontDirection...
Definition: bot.inl:104
void CancelAsyncPathComputation()
Cancel the current path computation.
Definition: bot.inl:63
KyResult ComputeNewPathToDestination(const Vec3f &destPos)
Launches an asynchronous path computation from the Bot position to destPos.
Definition: bot.inl:71
WorldElementType
Enumerates the WorldElement types.
Definition: worldelementtype.h:15
const Vec3f & GetVelocity() const
The velocity vector from BotInput passed by the user.
Definition: bot.inl:131
ResetTrajectoryStatus ExitManualControl()
If EnterManualControl() was called without NavTag then the current m_progressOnLivePath is used...
Base internal class used to represent elements that can be added to a World, such as instances of Dat...
Definition: worldelement.h:45
Definition: gamekitcrowddispersion.h:20
ManualControlStatus EnterManualControl()
Call this function if you wish to take manual control of the Bot, i.e.
The abstract base class for PathProgressComputer classes.
Definition: basepathprogresscomputer.h:37
Ptr< DatabaseBinding > m_databaseBinding
The Databases where the Bot will be spatialized.
Definition: bot.h:138
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
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:98
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
void SetNewPathNavigationProfileId(KyUInt32 navigationProfileId)
Sets the NavigationProfile that will be used in the new ComputeNewPathToDestination() and InitAStarQu...
Definition: bot.inl:57
#define KY_DEPRECATED(f)
Macro to mark a function, class or method as deprecated.
Definition: types.h:289
Maintains runtime validity information on a given Path.
Definition: pathvalidityinterval.h:88
void SetLocalCostOnPathDistance(KyFloat32 localCostOnPathDistance)
Set the distance along the path from the ProgressOnPath used to compute the local maximum cost multip...
Definition: bot.inl:53
Internal representation of world elements, using a vertical cylinder shape.
Definition: spatializedcylinder.h:56
const SpatializedCylinder & GetSpatializedCylinder() const
The SpatializedCylinder used to spatialized the Bot in the bound Databases.
Definition: bot.inl:23
void SetPathFinderConfig(const PathFinderConfig &pathFinderConfig)
The Path will not be recomputed after this call. The PathFinderConfig will be used by the next Comput...
static Vec2f Zero()
Returns a vector of zero size: (0,0).
Definition: vec2f.h:154
bool IsComputingNewPath() const
Call this method each time you want to compute a new Path.
Definition: bot.inl:21
void RemoveFromDatabase()
Removes the Bot from the Database (and thus from the World).
void ClearFollowedPath()
Clears the current LivePath and associated events.
This class aggregates all necessary information to describe a position on a LivePath, namely:
Definition: positiononlivepath.h:46
Vec3f ComputeMoveOnNavMeshWithTraverseLogic(const Kaim::Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
Helper function to compute the position the bot would reach if you apply the velocity for simulationT...
Definition: bot.inl:78
Each instance of this class uniquely identifies a single NavTriangle in a NavFloor.
Definition: navtriangleptr.h:22
Class that aggregates all parameters that allow to configure the PathFinding and the PathFollowing of...
Definition: botconfig.h:52
void SetSplineTrajectoryConfig(const SplineTrajectoryConfig &splineTrajectoryConfig)
The Trajectory will be recomputed the frame after this call.
KyResult InitAStarQueryForBot(Ptr< BaseAStarQuery > &astarQuery, const Vec3f &destPos)
Initialize a BaseAStarQuery that works is properly initialized for the Bot.
void SetDefaults()
Sets all members to their default value.
Definition: bot.h:115
void SetPathProgressConfig(const PathProgressConfig &pathProgressConfig)
The PathProgressConfig::m_pathValidationDistanceMinBackward and PathProgressConfig::m_pathValidationM...
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Set of parameters used by the ShortcutTrajectory and TargetOnPathComputer classes to update Bot targe...
Definition: shortcuttrajectoryconfig.h:109
void SetTrajectoryFailureMode(TrajectoryFailureMode trajectoryFailureMode)
Set the TrajectoryFailureMode, nothing in particular will be recomputed after this call...
Definition: bot.inl:50
void Init(const BotInitConfig &initConfig)
uses a default constructed BotConfig
Vec3f ComputeMoveOnNavMesh(const Kaim::Vec3f &velocity, KyFloat32 simulationTimeInSeconds)
Helper function to compute the position the bot would reach if you apply the velocity for simulationT...
void SetVelocityAndFrontDirection(const Vec3f &velocity)
For convenience, set velocity and deduce frontDirection from it.
Definition: bot.inl:122
ManualControlStatus
Definition: manualcontrolinterval.h:18
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...
This class aggregates a Path and all runtime related stuff namely the PathValidityInterval.
Definition: livepath.h:59
Each instance of this class uniquely identifies a single and mono-directionnal NavGraphEdge in a NavG...
Definition: navgraphedgeptr.h:25
void SetHeight(KyFloat32 height)
Height is only used to send the correct visualDebug.
const PositionOnPath * GetUpcomingEventPositionOnPath() const
Returns a pointer to the PositionOnPath of the PathEvent along the path after m_progressOnLivePath.
const NavTag * GetPreviousEventNavTag() const
Returns a pointer to the navTag along the path before m_progressOnLivePath.
void Clear()
Prepares this instance for destruction and / or reuse: sets all members to their default values and c...
This class computes the trajectory either with ShortcutTrajectory or with SplineTrajectory.
Definition: trajectory.h:30
The class representing a path.
Definition: path.h:42
void SetPosition(const Vec3f &position)
As Gameware Navigation never moves a bot, call this function to update the Bot position.
Definition: bot.inl:94
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43
This class defines a three-dimensional vector whose coordinates are stored using floating-point numbe...
Definition: vec3f.h:23
ResetTrajectoryStatus
Definition: resettrajectorystatus.h:14
void SetChannelComputerConfig(const ChannelComputerConfig &channelComputerConfig)
The path will not be recomputed after this call. The ChannelComputerConfig will be used by the next C...
const BotOutput & GetBotOutput() const
Returns the output computed during last World::Update()
Definition: bot.inl:139