gwnavruntime/pathfollower/targetonpath.h Source File

targetonpath.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 // primary contact: LAPA - secondary contact: NOBODY
8 #ifndef Navigation_TargetOnPath_H
9 #define Navigation_TargetOnPath_H
10 
13 #include "gwnavruntime/world/bot.h"
14 
15 
16 namespace Kaim
17 {
18 
21 {
25 
30 
35 
40 
43 };
44 KY_INLINE const char* GetTargetOnPathStatusDescription(TargetOnPathStatus status)
45 {
46  switch (status)
47  {
48  case TargetOnPathNotInitialized: return "NotInitialized";
49  case TargetOnPathUnknownReachability: return "UnknownReachability";
50  case TargetOnPathInInvalidNavData: return "InInvalidNavData";
51  case TargetOnPathNotReachable: return "NotReachable";
52  case TargetOnPathReachable: return "Reachable";
53  }
54  return "Undefined";
55 }
56 
57 class TargetOnPath
58 {
59 public:
60  TargetOnPath() { Clear(); }
61 
62  void Clear()
63  {
64  m_positionOnLivePath.Clear();
65  m_status = TargetOnPathNotInitialized;
66  m_marginMode = NoMargin;
67  m_nextShortcutSqDistTrigger = -1.f;
68  }
69 
71  bool IsTargetNotReachableOnNavMesh(const Bot* bot) const
72  {
73  return ((m_positionOnLivePath.GetPositionOnPathStatus() == PositionOnPathStatus_Undefined) ||
74  ((m_status == TargetOnPathNotReachable) &&
75  (m_positionOnLivePath.GetEdgeTypeToMoveOnBackward() == Kaim::PathEdgeType_OnNavMesh) &&
76  (bot->GetNavTrianglePtr().IsValid() == true) &&
77  (bot->GetProgressOnLivePathStatus() == ProgressOnPathOnNavMesh)));
78  }
79 
80 public:
81  // ----- State members -----
82  PositionOnLivePath m_positionOnLivePath;
83  TargetOnPathStatus m_status;
84 
85  // ----- Computation members -----
86  RayCanGoMarginMode m_marginMode; // margin to use to validate the TargetOnPath
87  KyFloat32 m_nextShortcutSqDistTrigger; // distance used to trigger a new computation of the target, it is updated when recomputing the target
88 };
89 
90 }
91 
92 #endif
Target on path is initialized but not validated.
Definition: targetonpath.h:29
Target on path is reachable in straight line.
Definition: targetonpath.h:42
TargetOnPathStatus
Enumerates the possible status values of Bot Position on path.
Definition: targetonpath.h:20
The PositionOnPath is not yet defined.
Definition: positiononpath.h:22
Target on path was on a valid NavData that has been streamed out (due to explicit streaming or Dynami...
Definition: targetonpath.h:34
Target on path is no more reachable in straight line.
Definition: targetonpath.h:39
RayCanGoMarginMode
Defines the different mode for the NavMesh border margin to be used in RayCanGo queries.
Definition: database.h:41
Definition: gamekitcrowddispersion.h:20
Margin to be used to get ray can go exactly on the NavMesh borders.
Definition: database.h:43
The PathEdge has been computed on the NavMesh.
Definition: path.h:29
Position on path has not been yet initialized at all.
Definition: targetonpath.h:24
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43