8 #ifndef Navigation_SplineTrajectory_H
9 #define Navigation_SplineTrajectory_H
24 class VisualDebugServer;
25 class SplineTrajectoryConfig;
26 class PositionOnLivePath;
27 class CircleArcSplineComputer;
29 class ComputeVelocityVisualDebug;
30 class BaseShortcutTrajectory;
32 class IAvoidanceComputer;
39 class SplineTrajectory:
public RefCountBase<SplineTrajectory, MemStat_PathFollowing>
48 void Compute(
KyFloat32 simulationTimeInSeconds, Ptr<BaseShortcutTrajectory> shortcutTrajectory);
62 void ClearTrajectory();
69 virtual void SendVisualDebugBlob(
VisualDebugServer& visualDebugServer, VisualDebugSendChangeEvent changeEvent);
70 void RemoveAllVisualDebugBeforeTrajectoryChange(
VisualDebugServer& visualDebugServer);
73 void ForceClearTrajectory();
74 void ClearSplineComputer();
75 void ClearSplineCut();
78 void UpdateShortcutSpline(
KyFloat32 simulationTimeInSeconds,
const FollowedCircleArcSpline& previousShortcutSpline, Ptr<BaseShortcutTrajectory> shortcutTrajectory);
81 bool IsBotBackInChannel();
82 bool IsBotOutOfChannel();
83 bool IsEndOfChannelReached();
84 bool IsFallbackToShortcutRequired();
86 void FollowFrozenSpline(
KyFloat32 simulationTimeInSeconds);
87 bool CanFrozenSplineBeFollowed();
92 void RequestSplineComputation();
93 void IntegrateSplineFromQuery();
95 bool ShouldRecomputeSpline(
const ChannelSectionPtr& upperBoundSection);
96 void ComputeSpline(
KyFloat32 simulationTimeInSeconds,
const ChannelSectionPtr& upperBoundSection);
98 void InitSplineStartPosition();
99 void ComputeSplineStartPosition();
100 void UpdateStartCutWithUpperBound(
const ChannelSectionPtr& upperBoundSection);
101 KyResult ComputeNewSplineEndPosition();
102 void CutFrozenSpline(
KyFloat32 simulationTimeInSeconds);
103 void AddStartConstraintToSplineQuery();
106 void ComputeSplineFromShortcutTrajectory(
KyFloat32 simulationTimeInSeconds, Ptr<BaseShortcutTrajectory> shortcutTrajectory);
111 void UpdateSplinePosition(
KyFloat32 simulationTimeInSeconds);
112 void UpdateSplineTargetPosition(
KyFloat32 simulationTimeInSeconds);
113 void ComputeMovingDirection2D(
KyFloat32 simulationTimeInSeconds,
Vec2f& out_movingDirection);
114 void ComputeVelocity(
KyFloat32 simulationTimeInSeconds);
117 void StopBot(
const Vec2f& frontDirection);
119 void DrawComputeVelocityVisualDebug(
const ComputeVelocityVisualDebug& collectedDebugData);
121 bool CapDirectionChangeAngle(
const Vec2f& normalizedFrom,
const Vec2f& normalizedTo,
Vec2f& result,
KyFloat32 maxAngleInRad)
const;
127 SplineCut() { Clear(); }
128 ~SplineCut() { Clear(); }
130 bool IsValid() {
return m_channelSectionIdx !=
KyUInt32MAXVAL && m_positionOnSpline.IsValid() && m_splineSection.IsInitialized(); }
134 m_positionOnSpline.Invalidate();
135 m_splineSection.Reset();
137 m_mode = CutSplineAtArcStart;
144 SplineCutMode m_mode;
149 Ptr<IAvoidanceComputer> m_avoidanceComputer;
154 ChannelSectionPtr m_splineComputerStartSection;
155 Vec3f m_splineComputerStartPosition;
160 SplineCutMode m_botPosSplineCutMode;
161 SplineCut m_splineCutThisFrame;
162 SplineCut m_splineCutWhenSplineRequested;
164 Ptr<CircleArcSplineComputationQuery> m_splineComputationQuery;
169 Vec2f m_previousMovingDirection;
170 float m_stopWaitTime;
172 bool m_advancedVisualDebuggingEnabled;
177 #endif // Navigation_SplineTrajectory_H
This class is the world element that represent an active character in Gameware Navigation.
Definition: bot.h:150
SplineTrajectory computes a CircleArcSpline that allows to anticipate and adapt the velocity in the t...
Definition: splinetrajectory.h:40
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Maintains a position moving along a given CricleArcSpline.
Definition: positiononcirclearcspline.h:64
RadiusProfile is an array of preferred radii.
Definition: radiusprofile.h:29
const FollowedCircleArcSpline * GetFollowedCircleArcSpline() const
Returns information about the currently followed circleArcSpline if any.
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
KyUInt32 m_positionOnSplineChannelSectionIdx
CircleArcSpline with start/end information as well current position and target.
Definition: splinetrajectory.h:161
Class that configures how the trajectory is computed from the Channel.
Definition: splinetrajectoryconfig.h:31
This class defines a two-dimensional vector whose coordinates are stored using floating-point numbers...
Definition: vec2f.h:24
Definition: gamekitcrowddispersion.h:20
Class used to compute a CircleArcSpline in a Channel.
Definition: circlearcsplinecomputer.h:89
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
CircleArcSpline with computation information and current position of follow.
Definition: followedcirclearcspline.h:31
The VisualDebugServer manages the sending of data to clients.
Definition: visualdebugserver.h:254
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
Class representing either an oriented circle arc or a straight line segment, to be aggregated into a ...
Definition: circlearcsplinesection.h:25
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226
This class computes the trajectory either with ShortcutTrajectory or with SplineTrajectory.
Definition: trajectory.h:30
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