#include <channel.h>
Channels define preferred navigation areas around an original Path section on NavMesh.
They are typically used to drive bots which inertia prevent to use reactive path follower to drive it correctly along the original path itself.
Trajectory provides a spline mode that needs a Channel to compute splines to drive the bot.
Inherits Kaim::RefCountBase< C, Stat >.
Main API Functions | |
KyUInt32 | GetGateCount () const |
const Gate & | GetGate (KyUInt32 index) const |
const KyArray< Vec2f > & | GetPreChannelPolyline () const |
const KyArray< Vec2f > & | GetPostChannelPolyline () const |
KyUInt32 | GetSectionCount () const |
KyUInt32 | GetLastSectionIdx () const |
KyUInt32 | GetSectionStartGateIdx (KyUInt32 sectionIdx) const |
KyUInt32 | GetSectionEndGateIdx (KyUInt32 sectionIdx) const |
const Gate & | GetSectionStartGate (KyUInt32 sectionIdx) const |
const Gate & | GetSectionEndGate (KyUInt32 sectionIdx) const |
const Vec3f & | GetEndPos () const |
KyUInt32 | GetFirstPathNodeIdx () const |
KyUInt32 | GetGatePathNodeIdx (KyUInt32 gateIndex) const |
bool | IsPositionInSection (const Vec2f &position, KyUInt32 sectionIndex, KyUInt32 &positionFlags) const |
bool | IsPositionInSection (const Vec2f &position, KyUInt32 sectionIndex) const |
KyResult | GetSectionFromPositionAndSeed (const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const |
KyResult | GetSectionFromPositionAndSeed_AlongBubble (const Bubble &bubble, const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx) const |
bool | IsConcaveCorner (KyUInt32 gateIdx, ChannelSide side) const |
For internal use only | |
KyArray< Gate > | m_gates |
KyArray< Vec2f > | m_preChannelPolyline |
KyArray< Vec2f > | m_postChannelPolyline |
KyUInt32 | m_firstPathNodeIdx |
KyResult | GetSectionFromPositionAndSeed (const Kaim::Vec3f &previousPosition, KyUInt32 previousSectionIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newSectionIdx, KyFloat32 maxProgress) const |
KyResult | GetSectionFromPositionAndSeed_Forward (const Kaim::Vec3f &previousPosition, KyUInt32 previousGateIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newGateIdx, KyFloat32 maxProgress) const |
KyResult | GetSectionFromPositionAndSeed_Backward (const Kaim::Vec3f &previousPosition, KyUInt32 previousGateIdx, const Kaim::Vec3f &newPosition, KyUInt32 &newGateIdx, KyFloat32 maxProgress) const |
bool | IntersectSegmentVsPreChannelPolyline (const Vec2f &A, const Vec2f &B, Vec2f &intersection) const |
bool | IntersectSegmentVsPostChannelPolyline (const Vec2f &A, const Vec2f &B, Vec2f &intersection) const |
void | SendVisualDebug (World *navWorld, const ChannelDisplayConfig &displayConfig=ChannelDisplayConfig(), KyUInt32 indexInChannelArray=0, const char *listBaseName="", const char *groupName="Channel", KyUInt32 visualDebugId=0xFFFFFFFF) const |
Creation functions | |
These functions are expected to be used internally in Channel computation classes. Though you can use them when creating your own Channel. | |
KyResult | InitFromBlob (const ChannelBlob &channelBlob) |
void | Initialize () |
void | Clear () |
void | AddGate (const Gate &gate) |
Gate & | GetGate (KyUInt32 index) |
void | SetPreChannelPolyline (const KyArray< Vec2f > &polyline) |
void | SetPostChannelPolyline (const KyArray< Vec2f > &polyline) |
void | SetPolylineFromBlob (const BlobArray< Vec2f > &polylineBlob, KyArray< Vec2f > &polyline) |
void | SetFirstPathNodeIdx (KyUInt32 firstPathNodeIdx) |
KyResult | ComputeChannelWidth () |
|
inline |
|
inline |
Return PathNodeIdx of the first gate.
Return PathNodeIdx of the gate at gateIndex.
KyResult Kaim::Channel::GetSectionFromPositionAndSeed | ( | const Kaim::Vec3f & | previousPosition, |
KyUInt32 | previousSectionIdx, | ||
const Kaim::Vec3f & | newPosition, | ||
KyUInt32 & | newSectionIdx | ||
) | const |
Given a previous position and its section, computes the section for a new position that is supposed to be near the previous one.
KyResult Kaim::Channel::GetSectionFromPositionAndSeed_AlongBubble | ( | const Bubble & | bubble, |
const Kaim::Vec3f & | previousPosition, | ||
KyUInt32 | previousSectionIdx, | ||
const Kaim::Vec3f & | newPosition, | ||
KyUInt32 & | newSectionIdx | ||
) | const |
Given a previous position and its section, computes the section for a new position that is supposed to be accessible from the previous one following a circle arc.
bool Kaim::Channel::IsPositionInSection | ( | const Vec2f & | position, |
KyUInt32 | sectionIndex, | ||
KyUInt32 & | positionFlags | ||
) | const |
Checks a provided 2D position is inside a channel section.
It updates positionFlags with a combination of the RelativePositionToChannelSectionFlag.
|
inline |
Just checks a provided 2D position is inside a channel section.