Example #1
0
        /// <summary>
        /// Constructs a TRS matrix (as an FbxAMatrix) from a tranform.
        /// </summary>
        /// <returns>The TRS matrix.</returns>
        /// <param name="t">Transform.</param>
        /// <param name="local">If set to <c>true</c> use local transform.</param>
        /// <param name="center">New center for global transform.</param>
        private FbxAMatrix ConstructTRSMatrix(Transform t, bool local = true, Vector3 center = default(Vector3))
        {
            var translation = local ? t.localPosition : ModelExporter.GetRecenteredTranslation(t, center);
            var rotation    = local ? t.localEulerAngles : t.eulerAngles;
            var scale       = local ? t.localScale : t.lossyScale;

            return(new FbxAMatrix(
                       new FbxVector4(translation.x, translation.y, translation.z),
                       new FbxVector4(rotation.x, rotation.y, rotation.z),
                       new FbxVector4(scale.x, scale.y, scale.z)
                       ));
        }