/// <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; }
/// <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; }