Slerp() public static méthode

public static Slerp ( Quaternion p, Quaternion q, float t ) : Quaternion
p UnityEngine.Quaternion
q UnityEngine.Quaternion
t float
Résultat UnityEngine.Quaternion
Exemple #1
0
        public static Quaternion GetQuatSquad(float t, Quaternion q0, Quaternion q1, Quaternion a0, Quaternion a1)
        {
            float      t1         = (float)(2.0 * (double)t * (1.0 - (double)t));
            Quaternion quaternion = MathUtils.Slerp(MathUtils.Slerp(q0, q1, t), MathUtils.Slerp(a0, a1, t), t1);
            float      num        = Mathf.Sqrt((float)((double)quaternion.x * (double)quaternion.x + (double)quaternion.y * (double)quaternion.y + (double)quaternion.z * (double)quaternion.z + (double)quaternion.w * (double)quaternion.w));

            quaternion.x /= num;
            quaternion.y /= num;
            quaternion.z /= num;
            quaternion.w /= num;
            return(quaternion);
        }
        public static Quaternion GetQuatSquad(float t, Quaternion q0, Quaternion q1, Quaternion a0, Quaternion a1)
        {
            float      t2     = 2f * t * (1f - t);
            Quaternion p      = MathUtils.Slerp(q0, q1, t);
            Quaternion q2     = MathUtils.Slerp(a0, a1, t);
            Quaternion result = MathUtils.Slerp(p, q2, t2);
            float      num    = Mathf.Sqrt(result.x * result.x + result.y * result.y + result.z * result.z + result.w * result.w);

            result.x /= num;
            result.y /= num;
            result.z /= num;
            result.w /= num;
            return(result);
        }