Core/GameObjects: Gameobject rotation (from cmangos/mangos-wotlk@2bcbc0f)

cmangos/mangos-wotlk@0fe88f3: [11531] Normalize gameobject's quaternion, thanks to zergtmn for pointing
cmangos/mangos-wotlk@060dfb7: [11667] Implement transport path rotation
cmangos/mangos-wotlk@565f52c: [11806] A bit gameobject code refactoring
cmangos/mangos-wotlk@6874951: [11807] Add gameobject_addon table
This commit is contained in:
Aokromes committed 2016-07-30 15:51:23 +02:00
1 parent b29d998044
commit b51adac24c
13 files changed
+899 -100

No files matched your search

+17 -6
View File
@@ -148,7 +148,7 @@ public:
GameObject* object = new GameObject;
ObjectGuid::LowType guidLow = map->GenerateLowGuid<HighGuid::GameObject>();
if (!object->Create(guidLow, objectInfo->entry, map, 0, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
if (!object->Create(guidLow, objectInfo->entry, map, 0, x, y, z, o, G3D::Quat(), 0, GO_STATE_READY))
{
delete object;
return false;
@@ -417,18 +417,29 @@ 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->UpdateRotationFields();
object->Relocate(object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
object->SetWorldRotationAngles(oz, oy, ox);
object->SaveToDB();
handler->PSendSysMessage(LANG_COMMAND_TURNOBJMESSAGE, object->GetGUID().GetCounter(), object->GetGOInfo()->name.c_str(), object->GetGUID().GetCounter(), o);