aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/content_cao.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index 8643b5824..22f62e6c3 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1000,10 +1000,16 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
float target_yaw = atan2(m_velocity.Z, m_velocity.X) * 180 / M_PI
+ m_prop.automatic_face_movement_dir_offset;
- float max_rotation_delta =
- dtime * m_prop.automatic_face_movement_max_rotation_per_sec;
+ float max_rotation_per_sec =
+ m_prop.automatic_face_movement_max_rotation_per_sec;
+ if (max_rotation_per_sec > 0) {
+ float max_rotation_delta = dtime * max_rotation_per_sec;
+
+ wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
+ } else
+ // Negative values of ...max_rotation_per_sec mean disabled.
+ m_rotation.Y = target_yaw;
- wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f);
rot_translator.val_current = m_rotation;
updateNodePos();