Ejemplo n.º 1
0
        public static FbxDouble3 XYZEulerFromQuaternion(Quaternion rotation)
        {
            // Unity wrappers don't have FbxVector4::SetXYZ(FbxQuaternion) to convert quat -> xyz euler.
            // We can abuse FbxAMatrix to do the same thing.

            FbxQuaternion fbxQuaternion = new FbxQuaternion(rotation.x, rotation.y, rotation.z, rotation.w);
            // We're using the FBX API to do the conversion to XYZ eulers.
            var mat = new FbxAMatrix();

            mat.SetIdentity();
            mat.SetQ(fbxQuaternion);
            // "The returned rotation vector is in Euler angle and the rotation order is XYZ."
            FbxVector4 v4 = mat.GetR();

            return(new FbxDouble3(v4.X, v4.Y, v4.Z));
        }