X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FEntityController.hpp;h=2724c5e9c8278e67858d3da5d384a24fa26c3796;hb=6a3227ca747d0598711f7354cd39897184e9fe6a;hp=ce3d0cf00998fbccf7826aa052766aca7a66cbe1;hpb=dc9e991ce52da5d89722e1b5f3862988afaa41cc;p=blank.git diff --git a/src/world/EntityController.hpp b/src/world/EntityController.hpp index ce3d0cf..2724c5e 100644 --- a/src/world/EntityController.hpp +++ b/src/world/EntityController.hpp @@ -1,11 +1,6 @@ #ifndef BLANK_WORLD_ENTITYCONTROLLER_HPP_ #define BLANK_WORLD_ENTITYCONTROLLER_HPP_ -#include "EntityState.hpp" - -#include - - namespace blank { class Entity; @@ -16,52 +11,6 @@ struct EntityController { virtual void Update(Entity &, float dt) = 0; - virtual glm::vec3 ControlForce(const Entity &, const EntityState &) const = 0; - - - /// try to add as much of add to out so it doesn't exceed max - /// returns true if it's maxed out - static bool MaxOutForce( - glm::vec3 &out, - const glm::vec3 &add, - float max - ) noexcept; - /// give a force that makes state come to a halt over 1/n seconds - static inline glm::vec3 Halt( - const EntityState &state, - float n - ) noexcept { - return state.velocity * -n; - } - /// give a force that makes state's velocity converge with given - /// target velocity over 1/n seconds - static inline glm::vec3 TargetVelocity( - const glm::vec3 &target, - const EntityState &state, - float n - ) noexcept { - return (target - state.velocity) * n; - } - /// give a force that makes state go after target with an attempted - /// acceleration over 1/n seconds and a speed of s - static inline glm::vec3 Seek( - const EntityState &state, - const EntityState &target, - float s, - float n - ) noexcept { - return TargetVelocity(normalize(target.Diff(state)) * s, state, n); - } - /// opposite of seek - static inline glm::vec3 Flee( - const EntityState &state, - const EntityState &target, - float s, - float n - ) noexcept { - return TargetVelocity(normalize(state.Diff(target)) * s, state, n); - } - }; }