X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fcreature%2FSteering.hpp;h=e67fed199320e17f6d4feb9162d5f9c7ead261df;hb=fbbee4cf7bd6f41139c2298c41d29b87401e6cf6;hp=6d5b40a2103e3d98cb8039c6010ac75e6fc85339;hpb=8a3907bb0bed257bf5d6f40f39f15114e8345913;p=blobs.git diff --git a/src/creature/Steering.hpp b/src/creature/Steering.hpp index 6d5b40a..e67fed1 100644 --- a/src/creature/Steering.hpp +++ b/src/creature/Steering.hpp @@ -1,7 +1,8 @@ #ifndef BLOBS_CREATURE_STEERING_HPP_ #define BLOBS_CREATURE_STEERING_HPP_ -#include "../graphics/glm.hpp" +#include "Situation.hpp" +#include "../math/glm.hpp" namespace blobs { @@ -12,33 +13,48 @@ class Creature; class Steering { public: - Steering(); + explicit Steering(const Creature &); ~Steering(); public: - void MaxAcceleration(double a) noexcept { max_accel = a; } - double MaxAcceleration() const noexcept { return max_accel; } + /// factor in [0,1] of how fast you need to get there + void Haste(double h) noexcept { haste = h; } + double Haste() const noexcept { return haste; } + + void MaxForce(double f) noexcept { max_force = f; } + double MaxForce() const noexcept { return max_force; } void MaxSpeed(double s) noexcept { max_speed = s; } double MaxSpeed() const noexcept { return max_speed; } public: + void Separate(double min_distance, double max_lookaround) noexcept; + void DontSeparate() noexcept; + void ResumeSeparate() noexcept; void Halt() noexcept; + void Pass(const glm::dvec3 &) noexcept; void GoTo(const glm::dvec3 &) noexcept; - glm::dvec3 Acceleration(Creature &) const noexcept; + glm::dvec3 Force(const Situation::State &) const noexcept; private: - bool SumForce(glm::dvec3 &out, const glm::dvec3 &in) const noexcept; + bool SumForce(glm::dvec3 &out, const glm::dvec3 &in, double max) const noexcept; + glm::dvec3 TargetVelocity(const Situation::State &, const glm::dvec3 &, double acc) const noexcept; private: - glm::dvec3 seek_target; + const Creature &c; + glm::dvec3 target; - double max_accel = 1.0; - double max_speed = 1.0; + double haste; + double max_force; + double max_speed; + double min_dist; + double max_look; + bool separating; bool halting; bool seeking; + bool arriving; };