/// <summary> /// Returns angular velocity from lastRotation to rotation /// </summary> public static Vector3 GetAngularVelocity(Quaternion lastRotation, Quaternion rotation, float deltaTime) { Quaternion rotationDelta = rotation * Quaternion.Inverse(lastRotation); float angle = 0f; Vector3 aV = Vector3.zero; rotationDelta.ToAngleAxis(out angle, out aV); if (float.IsNaN(aV.x)) { return(Vector3.zero); } if (float.IsInfinity(aV.x)) { return(Vector3.zero); } angle *= Mathf.Deg2Rad; angle /= deltaTime; angle = QuaTools.ToBiPolar(angle); aV *= angle; return(aV); }