diff options
Diffstat (limited to '')
-rw-r--r-- | src/content_sao.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index 2f849d3fc..1fd890044 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -457,11 +457,16 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) 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; - m_rotation.Y = wrapDegrees_0_360(m_rotation.Y); - wrappedApproachShortest(m_rotation.Y, target_yaw, max_rotation_delta, 360.f); + 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; + m_rotation.Y = wrapDegrees_0_360(m_rotation.Y); + 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; } } |