From 02cef6f034804eb7291f7539936226c0552cad7f Mon Sep 17 00:00:00 2001 From: ariel- Date: Sat, 30 Jul 2016 11:34:02 +0200 Subject: Core/GameObjects: Gameobject rotation (from cmangos/mangos-wotlk@2bcbc0f) (#14146) cmangos/mangos-wotlk@0fe88f35dfb: [11531] Normalize gameobject's quaternion, thanks to zergtmn for pointing cmangos/mangos-wotlk@060dfb791b: [11667] Implement transport path rotation cmangos/mangos-wotlk@565f52c6c1: [11806] A bit gameobject code refactoring cmangos/mangos-wotlk@6874951: [11807] Add gameobject_addon table Closes #14146 (cherry picked from commit 2967bf59b4a47837b85c995b732a6761c9c35f7e) # Conflicts: # src/server/game/Battlefield/Battlefield.cpp # src/server/game/Battlegrounds/Battleground.cpp # src/server/game/Entities/GameObject/GameObject.cpp # src/server/game/Entities/GameObject/GameObject.h # src/server/game/Entities/Object/Object.cpp # src/server/game/Globals/ObjectMgr.cpp # src/server/game/Spells/SpellEffects.cpp # src/server/scripts/Commands/cs_gobject.cpp # src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp # src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp --- src/server/scripts/Commands/cs_gobject.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/server/scripts/Commands') diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index 6de2b61b8be..493ae48148b 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -146,7 +146,7 @@ public: Map* map = player->GetMap(); GameObject* object = new GameObject; - if (!object->Create(objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) + if (!object->Create(objectInfo->entry, map, 0, x, y, z, o, G3D::Quat(), 0, GO_STATE_READY)) { delete object; return false; @@ -416,25 +416,36 @@ public: } char* orientation = strtok(NULL, " "); - float o; + float oz = 0.f, oy = 0.f, ox = 0.f; if (orientation) - o = (float)atof(orientation); + { + oz = float(atof(orientation)); + + orientation = strtok(NULL, " "); + if (orientation) + { + oy = float(atof(orientation)); + orientation = strtok(NULL, " "); + if (orientation) + ox = float(atof(orientation)); + } + } else { Player* player = handler->GetSession()->GetPlayer(); - o = player->GetOrientation(); + oz = player->GetOrientation(); } - object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o); - object->RelocateStationaryPosition(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), o); - object->UpdateRotationFields(); + object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ()); + object->RelocateStationaryPosition(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation()); + object->SetWorldRotationAngles(oz, oy, ox); object->DestroyForNearbyPlayers(); object->UpdateObjectVisibility(); object->SaveToDB(); - handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str(), o); + handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetSpawnId(), object->GetGOInfo()->name.c_str(), object->GetGUID().ToString().c_str(), object->GetOrientation()); return true; } -- cgit v1.2.3