diff options
| author | Rochet2 <rochet2@post.com> | 2018-10-28 11:07:56 +0200 |
|---|---|---|
| committer | Giacomo Pozzoni <giacomopoz@gmail.com> | 2018-10-28 10:07:56 +0100 |
| commit | 257ae44a20ed40469dd821845de8e27c0af838c7 (patch) | |
| tree | 0286f3286646fee2857d8dae44ae9882aa7589c0 /src/server/game/Entities/GameObject | |
| parent | 9bf69b3849a9d78f3e8d174ed6367a259aaf876f (diff) | |
Add rotation to .gob info (#22723)
* Add rotation to .gob info
- Add rotation (yaw, pitch, roll) to .gob info command
- Replace LANG_SPAWNINFO_DISTANCEFROMPLAYER with LANG_SPAWNINFO_ROTATION
- Fix description of .distance to describe the command arguments (the more you know..)
- Fix .gob info guid targetting nearest gameobject instead of finding with given guid
- Reorder the info data slightly
- Print location and rotation data regardless of object found in world
- Add error messages for when object is not found by guid or entry
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 5 | ||||
| -rw-r--r-- | src/server/game/Entities/GameObject/GameObjectData.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index ca2242c6aa4..188a8935d8f 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -92,6 +92,11 @@ bool QuaternionData::isUnit() const return fabs(x * x + y * y + z * z + w * w - 1.0f) < 1e-5f; } +void QuaternionData::toEulerAnglesZYX(float& Z, float& Y, float& X) const +{ + G3D::Matrix3(G3D::Quat(x, y, z, w)).toEulerAnglesZYX(Z, Y, X); +} + QuaternionData QuaternionData::fromEulerAnglesZYX(float Z, float Y, float X) { G3D::Quat quat(G3D::Matrix3::fromEulerAnglesZYX(Z, Y, X)); diff --git a/src/server/game/Entities/GameObject/GameObjectData.h b/src/server/game/Entities/GameObject/GameObjectData.h index b5b2262c410..81999bf5b88 100644 --- a/src/server/game/Entities/GameObject/GameObjectData.h +++ b/src/server/game/Entities/GameObject/GameObjectData.h @@ -603,6 +603,7 @@ struct TC_GAME_API QuaternionData QuaternionData(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { } bool isUnit() const; + void toEulerAnglesZYX(float& Z, float& Y, float& X) const; static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X); }; |
