]> git.localhorst.tv Git - blobs.git/blob - src/creature/Steering.hpp
use RK4 to integrate creature state
[blobs.git] / src / creature / Steering.hpp
1 #ifndef BLOBS_CREATURE_STEERING_HPP_
2 #define BLOBS_CREATURE_STEERING_HPP_
3
4 #include "Situation.hpp"
5 #include "../math/glm.hpp"
6
7
8 namespace blobs {
9 namespace creature {
10
11 class Steering {
12
13 public:
14         Steering();
15         ~Steering();
16
17 public:
18         void MaxAcceleration(double a) noexcept { max_accel = a; }
19         double MaxAcceleration() const noexcept { return max_accel; }
20
21         void MaxSpeed(double s) noexcept { max_speed = s; }
22         double MaxSpeed() const noexcept { return max_speed; }
23
24 public:
25         void Halt() noexcept;
26         void GoTo(const glm::dvec3 &) noexcept;
27
28         glm::dvec3 Acceleration(const Situation::State &) const noexcept;
29
30 private:
31         bool SumForce(glm::dvec3 &out, const glm::dvec3 &in) const noexcept;
32
33 private:
34         glm::dvec3 seek_target;
35
36         double max_accel = 1.0;
37         double max_speed = 1.0;
38
39         bool halting;
40         bool seeking;
41
42 };
43
44 }
45 }
46
47 #endif