X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2FEntity.hpp;fp=src%2Fworld%2FEntity.hpp;h=69fb0eb8cf7e7154590ddf52f88146428de75bd0;hb=170c0ff60b9679c954a9e74d5300c9929899b2bd;hp=efd9224a9f86f7f7e25fbc0dd42bb7d116ea56bf;hpb=8e9e2bb4b2dd5a4100f4531628ab58002fe253c1;p=blank.git diff --git a/src/world/Entity.hpp b/src/world/Entity.hpp index efd9224..69fb0eb 100644 --- a/src/world/Entity.hpp +++ b/src/world/Entity.hpp @@ -63,10 +63,6 @@ public: const glm::vec3 &Velocity() const noexcept { return state.velocity; } - bool Moving() const noexcept { - return dot(Velocity(), Velocity()) > std::numeric_limits::epsilon(); - } - const glm::vec3 &Position() const noexcept { return state.block_pos; } void Position(const glm::ivec3 &, const glm::vec3 &) noexcept; void Position(const glm::vec3 &) noexcept; @@ -96,6 +92,11 @@ public: /// get a ray in entity's face direction originating from center of vision Ray Aim(const Chunk::Pos &chunk_offset) const noexcept; + /// true if this entity's position will change (significantly) the next update + bool Moving() const noexcept { return speed > 0.0f; } + /// magnitude of velocity + float Speed() const noexcept { return speed; } + /// normalized velocity or heading if standing still const glm::vec3 &Heading() const noexcept { return heading; } void SetState(const EntityState &s) noexcept { state = s; UpdateModel(); } @@ -133,7 +134,7 @@ private: /// if this entity has no model, the eyes are assumed to /// be at local origin and oriented towards -Z glm::mat4 view_local; - /// normalized velocity or heading if standing still + float speed; glm::vec3 heading; // TODO: I'd prefer a drag solution