X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fui%2FPlayerController.hpp;h=9d54c295d944706fca27198d071eec5461a6b725;hb=0ab149c70b3f984b2cc0c7a122b4aa347bc5fd79;hp=9b4057b380d02c7a20582763103dc877580857fe;hpb=d30497e8e16c8470ce2f9f0b245befd196ea4660;p=blank.git diff --git a/src/ui/PlayerController.hpp b/src/ui/PlayerController.hpp index 9b4057b..9d54c29 100644 --- a/src/ui/PlayerController.hpp +++ b/src/ui/PlayerController.hpp @@ -4,6 +4,7 @@ #include #include "../world/EntityCollision.hpp" +#include "../world/EntityController.hpp" #include "../world/WorldCollision.hpp" @@ -12,7 +13,8 @@ namespace blank { class Player; class World; -class PlayerController { +class PlayerController +: public EntityController { public: PlayerController(World &, Player &); @@ -31,13 +33,16 @@ public: /// the magnitude (clamped to [0..1]) can be used to attenuate target velocity void SetMovement(const glm::vec3 &) noexcept; const glm::vec3 &GetMovement() const noexcept { return move_dir; } + + glm::vec3 ControlForce(const Entity &, const EntityState &) const override; + /// turn the controlled entity's head by given pitch and yaw deltas void TurnHead(float pitch, float yaw) noexcept; /// get player pitch in radians, normalized to [-PI/2,PI/2] - float GetPitch() const noexcept { return pitch; } + float GetPitch() const noexcept; /// get player yaw in radians, normalized to [-PI,PI] - float GetYaw() const noexcept { return yaw; } + float GetYaw() const noexcept; /// start doing primary action /// what exactly this means depends on the active item @@ -62,8 +67,6 @@ private: World &world; Player &player; glm::vec3 move_dir; - float pitch; - float yaw; bool dirty; WorldCollision aim_world;