- /// direction is rotation axis, magnitude is speed in rad/ms
- const glm::vec3 &AngularVelocity() const noexcept { return angular_velocity; }
- void AngularVelocity(const glm::vec3 &v) noexcept { angular_velocity = v; }
-
- const glm::quat &Orientation() const noexcept { return model.Orientation(); }
- void Orientation(const glm::quat &o) noexcept { model.Orientation(o); }
- void Rotate(const glm::quat &delta) noexcept;
-
- glm::mat4 ChunkTransform(const Chunk::Pos &chunk_offset) const noexcept;
- glm::mat4 Transform(const Chunk::Pos &chunk_offset) const noexcept;
- Ray Aim(const Chunk::Pos &chunk_offset) const noexcept;
+ /// orientation of local coordinate system
+ void Orientation(const glm::quat &o) noexcept { state.orient = o; }
+ const glm::quat &Orientation() const noexcept { return state.orient; }
+
+ /// orientation of head within local coordinate system, in radians
+ float Pitch() const noexcept { return state.pitch; }
+ float Yaw() const noexcept { return state.yaw; }
+ void TurnHead(float delta_pitch, float delta_yaw) noexcept;
+ void SetHead(float pitch, float yaw) noexcept;
+
+ /// get a transform for this entity's coordinate space
+ const glm::mat4 Transform() const noexcept { return model_transform; }
+ /// get a transform for this entity's coordinate space relative to reference chunk
+ glm::mat4 Transform(const glm::ivec3 &reference) const noexcept;
+ /// get a transform for this entity's view space relative to reference chunk
+ glm::mat4 ViewTransform(const glm::ivec3 &reference) const noexcept;
+ /// get a ray in entity's face direction originating from center of vision
+ Ray Aim(const ExactLocation::Coarse &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; }
+ const EntityState &GetState() const noexcept { return state; }