aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/lua_api.txt1
-rw-r--r--src/client/content_cao.cpp15
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 9685e8307..07758c237 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -6555,6 +6555,7 @@ Player properties need to be saved manually.
automatic_rotate = 0,
-- Set constant rotation in radians per second, positive or negative.
+ -- Object rotates along the local Y-axis, and works with set_rotation.
-- Set to 0 to disable constant rotation.
stepheight = 0,
diff --git a/src/client/content_cao.cpp b/src/client/content_cao.cpp
index eb1dad22b..867bbf2c8 100644
--- a/src/client/content_cao.cpp
+++ b/src/client/content_cao.cpp
@@ -1077,10 +1077,13 @@ void GenericCAO::step(float dtime, ClientEnvironment *env)
updateTextures(m_previous_texture_modifier);
}
}
+
if (!getParent() && std::fabs(m_prop.automatic_rotate) > 0.001) {
- m_rotation.Y += dtime * m_prop.automatic_rotate * 180 / M_PI;
- rot_translator.val_current = m_rotation;
- updateNodePos();
+ // This is the child node's rotation. It is only used for automatic_rotate.
+ v3f local_rot = node->getRotation();
+ local_rot.Y = modulo360f(local_rot.Y - dtime * core::RADTODEG *
+ m_prop.automatic_rotate);
+ node->setRotation(local_rot);
}
if (!getParent() && m_prop.automatic_face_movement_dir &&
@@ -1501,11 +1504,7 @@ void GenericCAO::processMessage(const std::string &data)
m_position = readV3F32(is);
m_velocity = readV3F32(is);
m_acceleration = readV3F32(is);
-
- if (std::fabs(m_prop.automatic_rotate) < 0.001f)
- m_rotation = readV3F32(is);
- else
- readV3F32(is);
+ m_rotation = readV3F32(is);
m_rotation = wrapDegrees_0_360_v3f(m_rotation);
bool do_interpolate = readU8(is);