diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2018-08-03 00:25:37 +0200 |
---|---|---|
committer | Paramat <paramat@users.noreply.github.com> | 2018-08-02 23:25:37 +0100 |
commit | f3997025fd4785606fe4f8b05037e9463c5be7da (patch) | |
tree | fb334a76f0781a2dd944f25b3e4969cd56a5241a /src/content_sao.cpp | |
parent | 741e3efaf5c8e6d85178051d8655971a7f8b0bb9 (diff) | |
download | minetest-f3997025fd4785606fe4f8b05037e9463c5be7da.tar.gz minetest-f3997025fd4785606fe4f8b05037e9463c5be7da.tar.bz2 minetest-f3997025fd4785606fe4f8b05037e9463c5be7da.zip |
Smoothed yaw rotation for objects (#6825)
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r-- | src/content_sao.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp index b67a63e3b..4ef52c7f2 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -443,14 +443,9 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) + m_prop.automatic_face_movement_dir_offset; float max_rotation_delta = dtime * m_prop.automatic_face_movement_max_rotation_per_sec; - float delta = wrapDegrees_0_360(target_yaw - m_yaw); - if (delta > max_rotation_delta && 360 - delta > max_rotation_delta) { - m_yaw += (delta < 180) ? max_rotation_delta : -max_rotation_delta; - m_yaw = wrapDegrees_0_360(m_yaw); - } else { - m_yaw = target_yaw; - } + m_yaw = wrapDegrees_0_360(m_yaw); + wrappedApproachShortest(m_yaw, target_yaw, max_rotation_delta, 360.f); } } |