Core/Misc: Fixed rotation of many gameobjects summoned in garrison and various scripts

This commit is contained in:
hondacrx
2018-05-08 15:36:23 -04:00
parent 9b40067017
commit f26f7a4348
14 changed files with 44 additions and 27 deletions
+11 -1
View File
@@ -476,10 +476,15 @@ namespace Framework.GameMath
public Quaternion ToUnit()
{
Quaternion copyOfThis = this;
copyOfThis *= rsq(dot(this));
copyOfThis.unitize();
return copyOfThis;
}
public void unitize()
{
this *= rsq(dot(this));
}
float dot(Quaternion other)
{
return (float)((X * other.X) + (Y * other.Y) + (Z * other.Z) + (W * other.W));
@@ -490,6 +495,11 @@ namespace Framework.GameMath
return 1.0f / (float)Math.Sqrt(x);
}
public static Quaternion fromEulerAnglesZYX(float z, float y, float x)
{
return new Quaternion(Matrix3.fromEulerAnglesZYX(z, y, x));
}
#region Public Static Complex Special Functions
/// <summary>
/// Calculates the logarithm of a given quaternion.