gwnavruntime/pathfollower/iavoidancecomputer.h Source File

iavoidancecomputer.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
8 
11 
12 namespace Kaim
13 {
14 
15 class Bot;
16 
19 {
28  Avoidance_NoTrajectory
29 };
30 
34 class IAvoidanceComputer: public RefCountBase<IAvoidanceComputer, MemStat_PathFollowing>
35 {
37 
38 public:
39  // ------------------------------ Functions -----------------------------
40 
42 
43  virtual ~IAvoidanceComputer() {}
44 
45  // ---------------------------------- Pure Virtual Functions ----------------------------------
46  virtual AvoidanceResult Compute(
47  Bot& bot, KyFloat32 simulationTimeInSeconds, KyFloat32 desiredSpeed, const Vec2f& movingDirection,
48  Vec2f& avoidanceVelocity, Vec2f& outputFrontDirection, bool& collide) = 0;
49 
50  static const char* GetAvoidanceResultString(AvoidanceResult avoidanceResult)
51  {
52  switch(avoidanceResult)
53  {
55  return "No avoidance";
56  case Avoidance_SlowDown:
57  return "Slow down";
59  return "Accelerate";
60  case Avoidance_Turn:
61  return "Turn";
62  case Avoidance_Stop:
63  return "Stop";
65  return "Solution not found";
67  return "Forcing passage";
69  return "Waiting for force passage";
70  default:
71  return "";
72  };
73  }
74 
75  static const char* GetAvoidanceResultDescription(AvoidanceResult avoidanceResult)
76  {
77  switch(avoidanceResult)
78  {
80  return "The trajectory goes in target direction at the desired speed";
81  case Avoidance_SlowDown:
82  return "The trajectory goes in target direction but at lower speed than the desired one";
84  return "The trajectory goes in target direction but at higher speed than the desired one";
85  case Avoidance_Turn:
86  return "The trajectory deviates from target direction";
87  case Avoidance_Stop:
88  return "The avoidance computer decided that stopping the Bot is the best solution";
90  return "The avoidance computer was not able to find any collision-free solutions";
92  return "The bot decided to force the passage";
94  return "The bot is required to wait for the force passage timer to expire";
95  default:
96  return "";
97  };
98  }
99 
100 public: // internal
101  virtual bool IsComputationRequiredThisFrame(Bot* /*bot*/, KyFloat32 /*timeToNextUpdate*/) { return true; }
102 };
103 
104 } // namespace Kaim
105 
This class is the world element that represent an active character in Autodesk Navigation.
Definition: bot.h:128
The avoidance computer was not able to find a collision-free solution.
Definition: iavoidancecomputer.h:25
The trajectory goes in target direction at the desired speed.
Definition: iavoidancecomputer.h:20
Waiting for force passage.
Definition: iavoidancecomputer.h:27
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
AvoidanceResult
Enumerates the possible results of a call to IAvoidanceComputer::Compute().
Definition: iavoidancecomputer.h:18
2d vector using KyFloat32.
Definition: vec2f.h:18
The trajectory deviates from target direction.
Definition: iavoidancecomputer.h:23
The trajectory goes in target direction but at higher speed than the desired one. ...
Definition: iavoidancecomputer.h:22
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
This interface class defines the way avoidance is computed.
Definition: iavoidancecomputer.h:34
Currently forcing the passage.
Definition: iavoidancecomputer.h:26
The avoidance computer decided that stopping the Bot is the best solution.
Definition: iavoidancecomputer.h:24
The trajectory goes in target direction but at lower speed than the desired one.
Definition: iavoidancecomputer.h:21
float KyFloat32
float
Definition: types.h:32