aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AISystem.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 12:06:13 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-14 12:06:13 +0100
commit332fd8a0df85062e8474acab84b469afeb89f72b (patch)
treea06cf5beaadb721b18c1add881282e12b4a38a99 /src/crepe/system/AISystem.cpp
parent8e72da5b2fec93be40f0c0a7f3199fc12f7681c9 (diff)
parentb9fc66f6922b1f40f2dbe14e8dfc4caa469654bc (diff)
merge master
Diffstat (limited to 'src/crepe/system/AISystem.cpp')
-rw-r--r--src/crepe/system/AISystem.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp
index 7f04432..680dbb8 100644
--- a/src/crepe/system/AISystem.cpp
+++ b/src/crepe/system/AISystem.cpp
@@ -1,22 +1,22 @@
#include <algorithm>
#include <cmath>
-#include "api/LoopTimer.h"
#include "manager/ComponentManager.h"
+#include "manager/LoopTimerManager.h"
#include "manager/Mediator.h"
#include "AISystem.h"
using namespace crepe;
+using namespace std::chrono;
void AISystem::update() {
const Mediator & mediator = this->mediator;
ComponentManager & mgr = mediator.component_manager;
- LoopTimer & timer = mediator.timer;
+ LoopTimerManager & loop_timer = mediator.loop_timer;
RefVector<AI> ai_components = mgr.get_components_by_type<AI>();
- //TODO: Use fixed loop dt (this is not available at master at the moment)
- double dt = timer.get_delta_time();
+ float dt = loop_timer.get_scaled_fixed_delta_time().count();
// Loop through all AI components
for (AI & ai : ai_components) {
@@ -144,7 +144,7 @@ vec2 AISystem::arrive(const AI & ai, const Rigidbody & rigidbody,
}
float speed = distance / ai.arrive_deceleration;
- speed = std::min(speed, rigidbody.data.max_linear_velocity.length());
+ speed = std::min(speed, rigidbody.data.max_linear_velocity);
vec2 desired_velocity = to_target * (speed / distance);
return desired_velocity - rigidbody.data.linear_velocity;