]> git.localhorst.tv Git - blobs.git/blob - src/creature/Steering.hpp
e67fed199320e17f6d4feb9162d5f9c7ead261df
[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 Creature;
12
13 class Steering {
14
15 public:
16         explicit Steering(const Creature &);
17         ~Steering();
18
19 public:
20         /// factor in [0,1] of how fast you need to get there
21         void Haste(double h) noexcept { haste = h; }
22         double Haste() const noexcept { return haste; }
23
24         void MaxForce(double f) noexcept { max_force = f; }
25         double MaxForce() const noexcept { return max_force; }
26
27         void MaxSpeed(double s) noexcept { max_speed = s; }
28         double MaxSpeed() const noexcept { return max_speed; }
29
30 public:
31         void Separate(double min_distance, double max_lookaround) noexcept;
32         void DontSeparate() noexcept;
33         void ResumeSeparate() noexcept;
34         void Halt() noexcept;
35         void Pass(const glm::dvec3 &) noexcept;
36         void GoTo(const glm::dvec3 &) noexcept;
37
38         glm::dvec3 Force(const Situation::State &) const noexcept;
39
40 private:
41         bool SumForce(glm::dvec3 &out, const glm::dvec3 &in, double max) const noexcept;
42         glm::dvec3 TargetVelocity(const Situation::State &, const glm::dvec3 &, double acc) const noexcept;
43
44 private:
45         const Creature &c;
46         glm::dvec3 target;
47
48         double haste;
49         double max_force;
50         double max_speed;
51         double min_dist;
52         double max_look;
53
54         bool separating;
55         bool halting;
56         bool seeking;
57         bool arriving;
58
59 };
60
61 }
62 }
63
64 #endif