diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-12 15:06:17 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-12 15:06:17 +0100 |
commit | 3de0a0f12d9d91e120f92975bda6f9915e5b8fcb (patch) | |
tree | d3da29d03914f4a7a644d6fbd47ed513b1270eaf /src/crepe/system/AISystem.cpp | |
parent | 641e202607b0f694df6662532f0165022c0f8621 (diff) | |
parent | a6350aa70a80e0fe1a6eade3b5eefd240b4942f2 (diff) |
merge physics
Diffstat (limited to 'src/crepe/system/AISystem.cpp')
-rw-r--r-- | src/crepe/system/AISystem.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp index 1d8ffb9..6578ecb 100644 --- a/src/crepe/system/AISystem.cpp +++ b/src/crepe/system/AISystem.cpp @@ -13,12 +13,10 @@ using namespace std::chrono; void AISystem::update() { const Mediator & mediator = this->mediator; ComponentManager & mgr = mediator.component_manager; - LoopTimerManager & timer = mediator.loop_timer; - RefVector<AI> ai_components = mgr.get_components_by_type<AI>(); 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) - duration_t dt = loop_timer.get_delta_time(); + duration_t dt = loop_timer.get_scaled_fixed_delta_time(); // Loop through all AI components for (AI & ai : ai_components) { @@ -45,7 +43,7 @@ void AISystem::update() { // Calculate the acceleration (using the above calculated force) vec2 acceleration = force / rigidbody.data.mass; // Finally, update Rigidbody's velocity - rigidbody.data.linear_velocity += acceleration * duration_cast<seconds>(dt).count(); + rigidbody.data.linear_velocity += acceleration * duration<float>(dt).count(); } } |