aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-09 11:36:24 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-09 11:36:24 +0100
commitc43885fa393ddf4ab28ad55643100f987b82abdc (patch)
tree2b2db7ed5ff488dbbde9d5a0c4997b91645c995d /src/crepe/system
parentf5169437395a8cdec4654c7d2bfef952f3dcde2c (diff)
Modified path_follow a bit
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/AISystem.cpp5
1 files 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()) {