X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fai%2FAIController.hpp;h=15645a256dd66aa604b70b491214da8e24e1e3c3;hb=fa3c4a14546d73ddc2671cd5cc58208839bf7173;hp=bd88290fdcb9d44075552807c560c9ac137411d5;hpb=4c34ddd7eeaa3cb71fc90bf76a0cd395682add66;p=blank.git diff --git a/src/ai/AIController.hpp b/src/ai/AIController.hpp index bd88290..15645a2 100644 --- a/src/ai/AIController.hpp +++ b/src/ai/AIController.hpp @@ -2,6 +2,7 @@ #define BLANK_AI_AICONTROLLER_HPP_ #include "../app/IntervalTimer.hpp" +#include "../geometry/primitive.hpp" #include "../world/EntityController.hpp" #include @@ -28,8 +29,6 @@ public: glm::vec3 ControlForce(const Entity &, const EntityState &) const override; - static glm::vec3 Heading(const EntityState &) noexcept; - /// get the closest player that given entity can see /// returns nullptr if none are in sight Player *ClosestVisiblePlayer(const Entity &) noexcept; @@ -54,7 +53,12 @@ public: void ExitHalt() noexcept; bool IsHalted() const noexcept; void SetHaltSpeed(float) noexcept; - glm::vec3 GetHaltForce(const EntityState &) const noexcept; + glm::vec3 GetHaltForce(const Entity &, const EntityState &) const noexcept; + + void StartAvoidingObstacles() noexcept; + void StopAvoidingObstacles() noexcept; + bool IsAvoidingObstacles() const noexcept; + glm::vec3 GetObstacleAvoidanceForce(const Entity &, const EntityState &) const noexcept; void StartFleeing() noexcept; void StopFleeing() noexcept; @@ -63,7 +67,7 @@ public: void SetFleeSpeed(float) noexcept; Entity &GetFleeTarget() noexcept; const Entity &GetFleeTarget() const noexcept; - glm::vec3 GetFleeForce(const EntityState &) const noexcept; + glm::vec3 GetFleeForce(const Entity &, const EntityState &) const noexcept; void StartSeeking() noexcept; void StopSeeking() noexcept; @@ -72,7 +76,7 @@ public: void SetSeekSpeed(float) noexcept; Entity &GetSeekTarget() noexcept; const Entity &GetSeekTarget() const noexcept; - glm::vec3 GetSeekForce(const EntityState &) const noexcept; + glm::vec3 GetSeekForce(const Entity &, const EntityState &) const noexcept; void StartEvading() noexcept; void StopEvading() noexcept; @@ -81,7 +85,7 @@ public: void SetEvadeSpeed(float) noexcept; Entity &GetEvadeTarget() noexcept; const Entity &GetEvadeTarget() const noexcept; - glm::vec3 GetEvadeForce(const EntityState &) const noexcept; + glm::vec3 GetEvadeForce(const Entity &, const EntityState &) const noexcept; void StartPursuing() noexcept; void StopPursuing() noexcept; @@ -90,7 +94,7 @@ public: void SetPursuitSpeed(float) noexcept; Entity &GetPursuitTarget() noexcept; const Entity &GetPursuitTarget() const noexcept; - glm::vec3 GetPursuitForce(const EntityState &) const noexcept; + glm::vec3 GetPursuitForce(const Entity &, const EntityState &) const noexcept; /// start wandering randomly void StartWandering() noexcept; @@ -106,7 +110,7 @@ public: float radius = 1.0f, float displacement = 1.0f ) noexcept; - glm::vec3 GetWanderForce(const EntityState &) const noexcept; + glm::vec3 GetWanderForce(const Entity &, const EntityState &) const noexcept; private: World &world; @@ -124,6 +128,10 @@ private: bool halted; float halt_speed; + bool avoid_obstacles; + AABB obstacle_box; + glm::mat4 obstacle_transform; + bool fleeing; Entity *flee_target; float flee_speed;