+void Entity::UpdateView() noexcept {
+ // create local transform
+ view_local = Transform(ChunkCoords());
+ // clear the translation part
+ view_local[3] = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
+ // add the model's eyes translation, if any
+ if (model) {
+ view_local *= model.EyesTransform();
+ }
+}
+
+void Entity::UpdateHeading() noexcept {
+ if (Moving()) {
+ heading = normalize(Velocity());
+ } else {
+ // use -Z (forward axis) of local view transform
+ heading = -glm::vec3(view_local[2]);
+ }
+}
+