From 0dbbbe4bac4ad4fcb9e88908034e90000056363e Mon Sep 17 00:00:00 2001 From: max-001 Date: Wed, 11 Dec 2024 14:10:43 +0100 Subject: Implemented feedback --- src/crepe/api/AI.cpp | 10 ++++++---- src/crepe/api/AI.h | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/crepe/api/AI.cpp b/src/crepe/api/AI.cpp index a4d3e98..2195249 100644 --- a/src/crepe/api/AI.cpp +++ b/src/crepe/api/AI.cpp @@ -1,6 +1,8 @@ #include +#include #include "AI.h" +#include "types.h" namespace crepe { @@ -19,7 +21,7 @@ void AI::make_circle_path(float radius, const vec2 & center, float start_angle, step = 2 * M_PI / MIN_STEP; } // The path node distance is determined by the step size and the radius - path_node_distance = radius * step * 0.75f; + this->path_node_distance = radius * step * PATH_NODE_DISTANCE_FACTOR; if (clockwise) { for (float i = start_angle; i < 2 * M_PI + start_angle; i += step) { @@ -47,10 +49,10 @@ void AI::make_oval_path(float radius_x, float radius_y, const vec2 & center, flo if (step > 2 * M_PI / MIN_STEP) { step = 2 * M_PI / MIN_STEP; } - // The path node distance is determined by the step size times the radius times 75% - this->path_node_distance = max_radius * step * 0.75f; + // The path node distance is determined by the step size and the radius + this->path_node_distance = max_radius * step * PATH_NODE_DISTANCE_FACTOR; - auto rotate_point = [rotation](vec2 point, vec2 center) { + std::function rotate_point = [rotation](vec2 point, vec2 center) { float s = sin(rotation); float c = cos(rotation); diff --git a/src/crepe/api/AI.h b/src/crepe/api/AI.h index 4f7692b..c780a91 100644 --- a/src/crepe/api/AI.h +++ b/src/crepe/api/AI.h @@ -121,6 +121,8 @@ private: static constexpr int MIN_STEP = 16; //! The radius to step size ratio for the path following behavior static constexpr float RADIUS_TO_STEP = 400.0f; + //! The path node distance factor for the path following behavior + static constexpr float PATH_NODE_DISTANCE_FACTOR = 0.75f; }; } // namespace crepe -- cgit v1.2.3