mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-12 16:58:39 +00:00
Add support for entities to automatic face movement direction
This commit is contained in:
parent
d718b0b34e
commit
fc571ad46d
7 changed files with 18 additions and 1 deletions
|
@ -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<u16, ServerActiveObject::Factory> 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){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue