示例#1
0
        /// <summary>
        ///         /// As the values of GML are way outside of unitys range, you should apply a global translate vector to it.
        /// SetTranslate tries to calculate that vector.
        /// </summary>
        /// <param name="directory"></param>
        void SetTranslate(DirectoryInfo directory)
        {
            if (!ApplyTranslation)
            {
                ActualTranslate = Vector3.zero;
                return;
            }

            if (Translate != Vector3.zero)
            {
                ActualTranslate = Translate;
                return;
            }

            Vector3 translate = Vector3.zero;
            var     count     = 0;

            foreach (var fileInfo in directory.GetFiles("*.gml"))
            {
                count++;
                translate += TranslateVector.GetTranslateVectorFromFile(fileInfo);
            }

            ActualTranslate = translate / count;
        }
示例#2
0
        /// <summary>
        /// As the values of GML are way outside of unitys range, you should apply a global translate vector to it.
        /// SetTranslate tries to calculate that vector.
        /// </summary>
        /// <param name="file"></param>
        void SetTranslate(FileInfo file)
        {
            if (!ApplyTranslation)
            {
                ActualTranslate = Vector3.zero;
                return;
            }

            ActualTranslate = Translate == Vector3.zero ? TranslateVector.GetTranslateVectorFromFile(file) : Translate;
        }