- const glm::vec3 &Velocity() const noexcept { return velocity; }
- void Velocity(const glm::vec3 &) noexcept;
-
- const Block::Pos &Position() const noexcept { return position; }
- void Position(const Block::Pos &) noexcept;
- void Move(const glm::vec3 &delta) noexcept;
-
- const Chunk::Pos ChunkCoords() const noexcept { return chunk; }
-
- const glm::quat &AngularVelocity() const noexcept { return angular_velocity; }
- void AngularVelocity(const glm::quat &) noexcept;
+ /// desired velocity in local coordinate system
+ const glm::vec3 &TargetVelocity() const noexcept { return tgt_vel; }
+ void TargetVelocity(const glm::vec3 &v) noexcept { tgt_vel = v; }
+
+ const glm::vec3 &Velocity() const noexcept { return state.velocity; }
+ void Velocity(const glm::vec3 &v) noexcept { state.velocity = v; }
+
+ 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;
+
+ const glm::ivec3 ChunkCoords() const noexcept { return state.chunk_pos; }
+
+ 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
+ const glm::quat &Orientation() const noexcept { return state.orient; }
+ void Orientation(const glm::quat &o) noexcept { state.orient = o; }
+
+ /// 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
+ glm::mat4 Transform(const glm::ivec3 &reference) const noexcept;
+ /// get a transform for this entity's view space
+ 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 Chunk::Pos &chunk_offset) const noexcept;