]> git.localhorst.tv Git - blobs.git/blob - src/creature/Steering.hpp
overhaul need system
[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 Halt() noexcept;
34         void Pass(const glm::dvec3 &) noexcept;
35         void GoTo(const glm::dvec3 &) noexcept;
36
37         glm::dvec3 Force(const Situation::State &) const noexcept;
38
39 private:
40         bool SumForce(glm::dvec3 &out, const glm::dvec3 &in, double max) const noexcept;
41         glm::dvec3 TargetVelocity(const Situation::State &, const glm::dvec3 &, double acc) const noexcept;
42
43 private:
44         const Creature &c;
45         glm::dvec3 target;
46
47         double haste;
48         double max_force;
49         double max_speed;
50         double min_dist;
51         double max_look;
52
53         bool separating;
54         bool halting;
55         bool seeking;
56         bool arriving;
57
58 };
59
60 }
61 }
62
63 #endif