Gonna move to server authority

This commit is contained in:
2022-01-31 17:27:38 +05:30
parent f3d21f4ec6
commit 7368968176
1354 changed files with 107808 additions and 80043 deletions

View File

@@ -0,0 +1,30 @@
using UnityEngine;
namespace FirstGearGames.Utilities.Maths
{
public static class Quaternions
{
/// <summary>
/// Returns if a rotational value matches another. This method is preferred over Equals or == since those variations allow larger differences before returning false.
/// </summary>
/// <param name="r"></param>
/// <param name="target"></param>
/// <param name="distance"></param>
/// <returns></returns>
public static bool Matches(this Quaternion r, Quaternion target, float? distance = null)
{
if (distance == null)
{
return (r.w == target.w && r.x == target.x && r.y == target.y && r.z == target.z);
}
else
{
float a = Vector3.SqrMagnitude(r.eulerAngles - target.eulerAngles);
return (a <= (distance * distance));
}
}
}
}