NoJobEngine 2.0.7
Loading...
Searching...
No Matches
NavAgent.h
Go to the documentation of this file.
1
6#pragma once
7
9
10#include <cstddef>
11
12#include <glm/glm.hpp>
13
14namespace NoJob
15{
16 class NavigationSystem;
17
19 {
20 public:
21 bool SetDestination(
22 const NavigationSystem& navigationSystem,
23 const glm::vec3& currentPosition,
24 const glm::vec3& destination);
25
26 bool RecalculatePath(
27 const NavigationSystem& navigationSystem,
28 const glm::vec3& currentPosition);
29
30 glm::vec3 Update(
31 const glm::vec3& currentPosition,
32 float deltaTime);
33
34 void Stop();
35
36 bool HasPath() const
37 {
38 return m_Path.IsValid() &&
39 m_CurrentWaypoint <
40 m_Path.Points.size();
41 }
42
44 {
45 return m_ReachedDestination;
46 }
47
48 const glm::vec3& GetDestination() const
49 {
50 return m_Destination;
51 }
52
53 const NavPointPath& GetPath() const
54 {
55 return m_Path;
56 }
57
58 std::size_t GetCurrentWaypointIndex() const
59 {
60 return m_CurrentWaypoint;
61 }
62
63 float& Speed()
64 {
65 return m_Speed;
66 }
67
68 float Speed() const
69 {
70 return m_Speed;
71 }
72
74 {
75 return m_StoppingDistance;
76 }
77
78 float StoppingDistance() const
79 {
80 return m_StoppingDistance;
81 }
82
83 private:
84 NavPointPath m_Path;
85
86 glm::vec3 m_Destination{ 0.0f };
87
88 std::size_t m_CurrentWaypoint = 0;
89
90 float m_Speed = 3.5f;
91 float m_StoppingDistance = 0.1f;
92
93 bool m_ReachedDestination = true;
94 };
95}
NavMeshFunnel declarations for the Navigation subsystem.
bool HasReachedDestination() const
Definition NavAgent.h:43
float Speed() const
Definition NavAgent.h:68
float StoppingDistance() const
Definition NavAgent.h:78
glm::vec3 Update(const glm::vec3 &currentPosition, float deltaTime)
Definition NavAgent.cpp:60
const glm::vec3 & GetDestination() const
Definition NavAgent.h:48
std::size_t GetCurrentWaypointIndex() const
Definition NavAgent.h:58
float & Speed()
Definition NavAgent.h:63
bool SetDestination(const NavigationSystem &navigationSystem, const glm::vec3 &currentPosition, const glm::vec3 &destination)
Definition NavAgent.cpp:10
bool RecalculatePath(const NavigationSystem &navigationSystem, const glm::vec3 &currentPosition)
Definition NavAgent.cpp:37
float & StoppingDistance()
Definition NavAgent.h:73
bool HasPath() const
Definition NavAgent.h:36
const NavPointPath & GetPath() const
Definition NavAgent.h:53