From 713c263cabbcf97029d7133ae0998634c525d55b Mon Sep 17 00:00:00 2001 From: nlitkowski Date: Mon, 20 Dec 2021 02:41:48 +0100 Subject: [PATCH] Fix script --- SW-Unity/Assets/Scripts/Main.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SW-Unity/Assets/Scripts/Main.cs b/SW-Unity/Assets/Scripts/Main.cs index d35859fa..fa41edc4 100644 --- a/SW-Unity/Assets/Scripts/Main.cs +++ b/SW-Unity/Assets/Scripts/Main.cs @@ -8,6 +8,7 @@ public class Main : MonoBehaviour { #region Constants string capturedFramesPath; + readonly bool mixedScene = false; #endregion #region Camera GUI fields @@ -122,19 +123,19 @@ public class Main : MonoBehaviour { for (int k = 0; k < rowsNumber * gridShiftZ; k += gridShiftZ) { - Vector3 rotationVector = new Vector3(0, Random.Range(0.0f, 360.0f), 0); - Vector3 rotationVectorShiftX = new Vector3(-90.0f, Random.Range(0.0f, 360.0f), 0); + GameObject tree = SelectRandomTree(); + float xRotation = tree.name.StartsWith("AS") ? 0.0f : -90.0f; + Vector3 rotationVector = new Vector3(xRotation, Random.Range(0.0f, 360.0f), 0); randomShiftX = random.Next(0, maxShiftValue); randomShiftZ = random.Next(0, maxShiftValue); - GameObject tree = SelectRandomTree(); - if (tree.name.StartsWith("AS")) + if (tree.name.StartsWith("AS") || tree.name.StartsWith("EU")) { renderedTrees.Add(Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVector))); } else { - GameObject duzySKurwol = Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVectorShiftX)); + GameObject duzySKurwol = Instantiate(tree, new Vector3(i + positionShift_x + randomShiftX, 0, k + positionShift_z + randomShiftZ), Quaternion.Euler(rotationVector)); duzySKurwol.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f); renderedTrees.Add(duzySKurwol); } @@ -142,7 +143,10 @@ public class Main : MonoBehaviour } capturedFramesPath = Path.Combine(Application.dataPath, "..", "..", "Trees", tree1.name); - + if (mixedScene) + { + capturedFramesPath = Path.Combine(capturedFramesPath, "mixed"); + } if (!Directory.Exists(capturedFramesPath)) { Directory.CreateDirectory(capturedFramesPath);