From c43885fa393ddf4ab28ad55643100f987b82abdc Mon Sep 17 00:00:00 2001 From: max-001 Date: Mon, 9 Dec 2024 11:36:24 +0100 Subject: Modified path_follow a bit --- src/crepe/system/AISystem.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp index 7b801c3..72f3d9b 100644 --- a/src/crepe/system/AISystem.cpp +++ b/src/crepe/system/AISystem.cpp @@ -152,9 +152,10 @@ vec2 AISystem::path_follow(AI & ai) { return vec2{0, 0}; } - vec2 to_target = ai.path.at(ai.path_index) - transform.position; + vec2 target = ai.path.at(ai.path_index); + vec2 to_target = target - transform.position; if (to_target.length_squared() > ai.path_node_distance * ai.path_node_distance) { - ai.seek_target = ai.path.at(ai.path_index); + ai.seek_target = target; } else { ai.path_index++; if (ai.path_index >= ai.path.size()) { -- cgit v1.2.3