8#include <unordered_map>
53 std::unordered_map<GraphPosition, std::reference_wrapper<NavigationNode>,
63 std::optional<std::reference_wrapper<NavigationNode>>
get_node(
96 const Vector3& world_position)
const;
129 int max_drop_distance_{10};
130 int max_jump_distance_{4};
131 float node_vertical_offset_{16.0f};
138 void generate_nodes();
141 std::optional<std::reference_wrapper<NavigationNode>> find_node_in_children(
Base class for all components that can be attached to GameObjects.
Definition component.h:24
const std::optional< std::reference_wrapper< GameObject > > & parent() const noexcept
Gets the parent GameObject of this component.
Concept to constrain types to be derived from Component.
Definition gameObject.h:33
Component representing a navigation graph for AI pathfinding.
Definition navigation_graph.h:29
int max_drop_distance() const noexcept
NavigationGraph & generate_graph()
Generates the navigation graph by populating it with nodes.
std::optional< GraphPosition > get_position_of_node(const NavigationNode &node) const
void update(float dt) override
Update is left empty as the navigation graph does not require per-frame updates.
Definition navigation_graph.h:35
GraphPosition world_to_graph_position(const Vector3 &world_position) const
std::optional< std::reference_wrapper< NavigationNode > > get_node(const GraphPosition &position) const
Retrieves a navigation node at the specified position.
NavigationGraph & remove_node(const GraphPosition &position)
Removes a navigation node at the specified position.
std::optional< std::reference_wrapper< NavigationNode > > get_closest_node(const GraphPosition &position) const
Finds the closest navigation node to the specified position.
int max_jump_distance() const noexcept
NavigationGraph & add_node(const GraphPosition &position, NavigationNode &node)
Adds a navigation node at the specified position.
NavigationGraph & stride(int stride) noexcept
NavigationGraph(int grid_size=16, int stride=10)
int get_stride() const noexcept
std::optional< std::reference_wrapper< NavigationNode > > get_closest_node(const Vector3 &world_position) const
int get_grid_max_x() const noexcept
int get_grid_size() const noexcept
NavigationGraph & clear()
Clears all nodes from the navigation graph.
std::unordered_map< GraphPosition, std::reference_wrapper< NavigationNode >, GraphPositionHash > & get_nodes()
std::string type_name() const override
Provides a consistent type name for the component.
int get_grid_max_y() const noexcept
Component representing a navigation node in a navigation graph.
Definition navigation_node.h:25
Represents a 3D vector with x, y, and z components. This class provides basic vector operations such ...
Definition vector3.h:8
Hash function for GraphPosition to be used in unordered containers. Combines the hash values of the x...
Definition graph.h:41
Structure representing a position in the navigation graph.
Definition graph.h:29