+ float MaxVelocity() const noexcept { return max_vel; }
+ void MaxVelocity(float v) noexcept { max_vel = v; }
+ float MaxControlForce() const noexcept { return max_force; }
+ void MaxControlForce(float f) noexcept { max_force = f; }
+
+ glm::vec3 ControlForce(const EntityState &) const noexcept;
+
+ const glm::vec3 &Velocity() const noexcept { return state.velocity; }
+
+ const ExactLocation::Fine &Position() const noexcept { return state.pos.block; }
+ void Position(const ExactLocation::Coarse &, const ExactLocation::Fine &) noexcept;
+ void Position(const ExactLocation::Fine &) noexcept;
+
+ const glm::ivec3 ChunkCoords() const noexcept { return state.pos.chunk; }
+
+ glm::vec3 AbsolutePosition() const noexcept {
+ return state.AbsolutePosition();
+ }
+ glm::vec3 AbsoluteDifference(const Entity &other) const noexcept {
+ return state.Diff(other.state);
+ }
+
+ /// 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; }
+
+ void Ref() noexcept { ++ref_count; }
+ void UnRef() noexcept { --ref_count; }
+ void Kill() noexcept { dead = true; }
+ bool Referenced() const noexcept { return ref_count > 0; }
+ bool Dead() const noexcept { return dead; }
+ bool CanRemove() const noexcept { return dead && ref_count <= 0; }
+
+ void Update(World &, float dt);
+
+ void Render(const glm::mat4 &M, DirectionalLighting &prog) noexcept {
+ if (model) model.Render(M, prog);
+ }