From fc571ad46df8f3dcc04745bc55d9ca6e1e82ed87 Mon Sep 17 00:00:00 2001 From: sapier Date: Wed, 31 Jul 2013 17:29:25 +0200 Subject: Add support for entities to automatic face movement direction --- src/content_sao.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/content_sao.cpp') diff --git a/src/content_sao.cpp b/src/content_sao.cpp index ed660cf10..f3ccd6db0 100644 --- a/src/content_sao.cpp +++ b/src/content_sao.cpp @@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "cpp_api/scriptapi.h" #include "genericobject.h" #include "util/serialize.h" +#include "util/mathconstants.h" std::map ServerActiveObject::m_types; @@ -522,6 +523,10 @@ void LuaEntitySAO::step(float dtime, bool send_recommended) * dtime * m_acceleration; m_velocity += dtime * m_acceleration; } + + if(m_prop.automatic_face_movement_dir){ + m_yaw = atan2(m_velocity.Z,m_velocity.X) * 180 / M_PI; + } } if(m_registered){ -- cgit v1.2.3