]> git.localhorst.tv Git - blobs.git/blob - src/creature/Steering.hpp
avoid others when steering
[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         void MaxAcceleration(double a) noexcept { max_accel = a; }
21         double MaxAcceleration() const noexcept { return max_accel; }
22
23         void MaxSpeed(double s) noexcept { max_speed = s; }
24         double MaxSpeed() const noexcept { return max_speed; }
25
26 public:
27         void Separate(double min_distance, double max_lookaround) noexcept;
28         void DontSeparate() noexcept;
29         void Halt() noexcept;
30         void Pass(const glm::dvec3 &) noexcept;
31         void GoTo(const glm::dvec3 &) noexcept;
32
33         glm::dvec3 Acceleration(const Situation::State &) const noexcept;
34
35 private:
36         bool SumForce(glm::dvec3 &out, const glm::dvec3 &in) const noexcept;
37         glm::dvec3 TargetVelocity(const Situation::State &, const glm::dvec3 &) const noexcept;
38
39 private:
40         const Creature &c;
41         glm::dvec3 target;
42
43         double max_accel;
44         double max_speed;
45         double min_dist;
46         double max_look;
47
48         bool separating;
49         bool halting;
50         bool seeking;
51         bool arriving;
52
53 };
54
55 }
56 }
57
58 #endif