diff options
author | CoderForTheBetter <marcumjp@gmail.com> | 2018-11-28 03:38:50 -0500 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-11-28 09:38:50 +0100 |
commit | faa358e797128ab07bb5644ce305a832d59e5596 (patch) | |
tree | dcf05ef0611b839503c4845fd89ad9519ee1c4bb /src/content_cao.h | |
parent | 9519d57017cfa28eb4f2fbf3c780f826017bbb00 (diff) | |
download | minetest-faa358e797128ab07bb5644ce305a832d59e5596.tar.gz minetest-faa358e797128ab07bb5644ce305a832d59e5596.tar.bz2 minetest-faa358e797128ab07bb5644ce305a832d59e5596.zip |
Add Lua methods 'set_rotation()' and 'get_rotation()' (#7395)
* Adds Lua methods 'set_rotation()' and 'get_rotation'. Also changed some method names to be more clear. Instead of an f32 being sent over network for yaw, now a v3f is sent for rotation on xyz axes. Perserved Lua method set_yaw/setyaw so that old mods still work, other wise to set yaw they would need to switch to set_rotation(0, yaw, 0).
Diffstat (limited to 'src/content_cao.h')
-rw-r--r-- | src/content_cao.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/content_cao.h b/src/content_cao.h index 9e688d78d..98932137e 100644 --- a/src/content_cao.h +++ b/src/content_cao.h @@ -59,6 +59,11 @@ struct SmoothTranslatorWrapped : SmoothTranslator<f32> void translate(f32 dtime); }; +struct SmoothTranslatorWrappedv3f : SmoothTranslator<v3f> +{ + void translate(f32 dtime); +}; + class GenericCAO : public ClientActiveObject { private: @@ -80,10 +85,10 @@ private: v3f m_position = v3f(0.0f, 10.0f * BS, 0); v3f m_velocity; v3f m_acceleration; - float m_yaw = 0.0f; + v3f m_rotation; s16 m_hp = 1; SmoothTranslator<v3f> pos_translator; - SmoothTranslatorWrapped yaw_translator; + SmoothTranslatorWrappedv3f rot_translator; // Spritesheet/animation stuff v2f m_tx_size = v2f(1,1); v2s16 m_tx_basepos; @@ -146,9 +151,10 @@ public: virtual bool getSelectionBox(aabb3f *toset) const; v3f getPosition(); - inline float getYaw() const + + inline const v3f &getRotation() { - return m_yaw; + return m_rotation; } const bool isImmortal(); |