Core/Misc: Fixed rotation of many gameobjects summoned in garrison and various scripts
This commit is contained in:
@@ -1286,7 +1286,7 @@ namespace Game.AI
|
||||
continue;
|
||||
|
||||
Position pos = obj.GetPositionWithOffset(new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o));
|
||||
Quaternion rot = new Quaternion(Matrix3.fromEulerAnglesZYX(pos.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rot = Quaternion.fromEulerAnglesZYX(pos.GetOrientation(), 0.0f, 0.0f);
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, pos, rot, e.Action.summonGO.despawnTime);
|
||||
}
|
||||
}
|
||||
@@ -1294,7 +1294,7 @@ namespace Game.AI
|
||||
if (e.GetTargetType() != SmartTargets.Position)
|
||||
break;
|
||||
|
||||
Quaternion rot1 = new Quaternion(Matrix3.fromEulerAnglesZYX(e.Target.o, 0.0f, 0.0f));
|
||||
Quaternion rot1 = Quaternion.fromEulerAnglesZYX(e.Target.o, 0.0f, 0.0f);
|
||||
summoner.SummonGameObject(e.Action.summonGO.entry, new Position(e.Target.x, e.Target.y, e.Target.z, e.Target.o), rot1, e.Action.summonGO.despawnTime);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ namespace Game.BattleGrounds
|
||||
Log.outDebug(LogFilter.Battleground, "Battleground.AddObject: gameoobject [entry: {0}, object type: {1}] for BG (map: {2}) has zeroed rotation fields, " +
|
||||
"orientation used temporally, but please fix the spawn", entry, type, m_MapId);
|
||||
|
||||
rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(o, 0.0f, 0.0f));
|
||||
rotation = Quaternion.fromEulerAnglesZYX(o, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
// Must be created this way, adding to godatamap would add it to the base map of the instance
|
||||
|
||||
@@ -473,7 +473,7 @@ namespace Game.Chat
|
||||
Player player = handler.GetPlayer();
|
||||
Map map = player.GetMap();
|
||||
|
||||
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, new Quaternion(Matrix3.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f)), 255, GameObjectState.Ready);
|
||||
GameObject obj = GameObject.CreateGameObject(objectInfo.entry, map, player, Quaternion.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f), 255, GameObjectState.Ready);
|
||||
if (!obj)
|
||||
return false;
|
||||
|
||||
@@ -517,7 +517,7 @@ namespace Game.Chat
|
||||
if (spawntime != 0)
|
||||
spawntm = spawntime;
|
||||
|
||||
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(player.GetOrientation(), 0.0f, 0.0f);
|
||||
|
||||
if (Global.ObjectMgr.GetGameObjectTemplate(id) == null)
|
||||
{
|
||||
|
||||
@@ -234,7 +234,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
SetWorldRotation(rotation);
|
||||
SetWorldRotation(rotation.X, rotation.Y, rotation.Z, rotation.W);
|
||||
GameObjectAddon gameObjectAddon = Global.ObjectMgr.GetGameObjectAddon(GetSpawnId());
|
||||
|
||||
// For most of gameobjects is (0, 0, 0, 1) quaternion, there are only some transports with not standard rotation
|
||||
@@ -2067,9 +2067,14 @@ namespace Game.Entities
|
||||
m_packedRotation = z | (y << 21) | (x << 42);
|
||||
}
|
||||
|
||||
public void SetWorldRotation(Quaternion quaternion)
|
||||
public void SetWorldRotation(float qx, float qy, float qz, float qw)
|
||||
{
|
||||
m_worldRotation = quaternion.ToUnit();
|
||||
Quaternion rotation = new Quaternion(qx, qy, qz, qw);
|
||||
rotation.unitize();
|
||||
m_worldRotation.X = rotation.X;
|
||||
m_worldRotation.Y = rotation.Y;
|
||||
m_worldRotation.Z = rotation.Z;
|
||||
m_worldRotation.W = rotation.W;
|
||||
UpdatePackedRotation();
|
||||
}
|
||||
|
||||
@@ -2083,8 +2088,8 @@ namespace Game.Entities
|
||||
|
||||
public void SetWorldRotationAngles(float z_rot, float y_rot, float x_rot)
|
||||
{
|
||||
Quaternion quat = new Quaternion(Matrix3.fromEulerAnglesZYX(z_rot, y_rot, x_rot));
|
||||
SetWorldRotation(quat);
|
||||
Quaternion quat = Quaternion.fromEulerAnglesZYX(z_rot, y_rot, x_rot);
|
||||
SetWorldRotation(quat.X, quat.Y, quat.Z, quat.W);
|
||||
}
|
||||
|
||||
public void ModifyHealth(int change, Unit attackerOrHealer = null, uint spellId = 0)
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Game.Entities
|
||||
SetGoType(GameObjectTypes.MapObjTransport);
|
||||
SetGoAnimProgress(animprogress);
|
||||
SetName(goinfo.name);
|
||||
SetWorldRotation(Quaternion.WAxis);
|
||||
SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
SetParentRotation(Quaternion.WAxis);
|
||||
|
||||
m_model = CreateModel();
|
||||
|
||||
@@ -269,6 +269,7 @@ namespace Game.Garrisons
|
||||
plotInfo.PacketInfo.GarrPlotInstanceID = garrPlotInstanceId;
|
||||
plotInfo.PacketInfo.PlotPos.Relocate(gameObject.Pos.X, gameObject.Pos.Y, gameObject.Pos.Z, 2 * (float)Math.Acos(gameObject.Rot[3]));
|
||||
plotInfo.PacketInfo.PlotType = plot.PlotType;
|
||||
plotInfo.Rotation = new Quaternion(gameObject.Rot[0], gameObject.Rot[1], gameObject.Rot[2], gameObject.Rot[3]);
|
||||
plotInfo.EmptyGameObjectId = gameObject.Id;
|
||||
plotInfo.GarrSiteLevelPlotInstId = plots[i].Id;
|
||||
}
|
||||
@@ -707,7 +708,7 @@ namespace Game.Garrisons
|
||||
return null;
|
||||
}
|
||||
|
||||
GameObject go = GameObject.CreateGameObject(entry, map, PacketInfo.PlotPos, Quaternion.WAxis, 255, GameObjectState.Ready);
|
||||
GameObject go = GameObject.CreateGameObject(entry, map, PacketInfo.PlotPos, Rotation, 255, GameObjectState.Ready);
|
||||
if (!go)
|
||||
return null;
|
||||
|
||||
@@ -717,7 +718,7 @@ namespace Game.Garrisons
|
||||
if (finalizeInfo != null)
|
||||
{
|
||||
Position pos2 = finalizeInfo.factionInfo[faction].Pos;
|
||||
GameObject finalizer = GameObject.CreateGameObject(finalizeInfo.factionInfo[faction].GameObjectId, map, pos2, Quaternion.WAxis, 255, GameObjectState.Ready);
|
||||
GameObject finalizer = GameObject.CreateGameObject(finalizeInfo.factionInfo[faction].GameObjectId, map, pos2, Quaternion.fromEulerAnglesZYX(pos2.GetOrientation(), 0.0f, 0.0f), 255, GameObjectState.Ready);
|
||||
if (finalizer)
|
||||
{
|
||||
// set some spell id to make the object delete itself after use
|
||||
@@ -845,6 +846,7 @@ namespace Game.Garrisons
|
||||
}
|
||||
|
||||
public GarrisonPlotInfo PacketInfo;
|
||||
public Quaternion Rotation;
|
||||
public uint EmptyGameObjectId;
|
||||
public uint GarrSiteLevelPlotInstId;
|
||||
public Building BuildingInfo;
|
||||
|
||||
@@ -2849,7 +2849,7 @@ namespace Game.Spells
|
||||
Map map = target.GetMap();
|
||||
|
||||
Position pos = new Position(x, y, z, target.GetOrientation());
|
||||
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(target.GetOrientation(), 0.0f, 0.0f);
|
||||
GameObject go = GameObject.CreateGameObject((uint)effectInfo.MiscValue, map, pos, rotation, 255, GameObjectState.Ready);
|
||||
if (!go)
|
||||
return;
|
||||
@@ -3509,7 +3509,7 @@ namespace Game.Spells
|
||||
posZ = m_caster.GetPositionZ(),
|
||||
Orientation = m_caster.GetOrientation()
|
||||
};
|
||||
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(pos.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(pos.GetOrientation(), 0.0f, 0.0f);
|
||||
|
||||
GameObject go = GameObject.CreateGameObject((uint)effectInfo.MiscValue, map, pos, rotation, 0, GameObjectState.Ready);
|
||||
if (!go)
|
||||
@@ -3850,7 +3850,7 @@ namespace Game.Spells
|
||||
|
||||
Map map = m_caster.GetMap();
|
||||
Position pos = new Position(x, y, z, m_caster.GetOrientation());
|
||||
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
|
||||
GameObject go = GameObject.CreateGameObject((uint)effectInfo.MiscValue, map, pos, rotation, 255, GameObjectState.Ready);
|
||||
if (!go)
|
||||
return;
|
||||
@@ -4537,7 +4537,7 @@ namespace Game.Spells
|
||||
m_caster.GetPosition(out fx, out fy, out fz);
|
||||
|
||||
Position pos = new Position(fx, fy, fz, m_caster.GetOrientation());
|
||||
Quaternion rotation = new Quaternion(Matrix3.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f));
|
||||
Quaternion rotation = Quaternion.fromEulerAnglesZYX(m_caster.GetOrientation(), 0.0f, 0.0f);
|
||||
GameObject go = GameObject.CreateGameObject(name_id, cMap, pos, rotation, 255, GameObjectState.Ready);
|
||||
if (!go)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user