Core/GameObjects: Validate rotation quaternion at startup

Port From (https://github.com/TrinityCore/TrinityCore/commit/9005bdc684eb37718371f921bd570692375a6c7a)
This commit is contained in:
hondacrx
2021-12-07 20:20:39 -05:00
parent 73b84ca811
commit e1d1157f87
+6
View File
@@ -4214,6 +4214,12 @@ namespace Game
continue;
}
if (!(Math.Abs(Quaternion.Dot(data.rotation, data.rotation) - 1) < 1e-5))
{
Log.outError(LogFilter.Sql, $"Table `gameobject` has gameobject (GUID: {guid} Entry: {data.Id}) with invalid rotation quaternion (non-unit), defaulting to orientation on Z axis only");
data.rotation = Quaternion.CreateFromRotationMatrix(Extensions.fromEulerAnglesZYX(data.spawnPoint.GetOrientation(), 0f, 0f));
}
if (WorldConfig.GetBoolValue(WorldCfg.CalculateGameobjectZoneAreaData))
{
PhasingHandler.InitDbVisibleMapId(phaseShift, data.terrainSwapMap);