Fix script

This commit is contained in:
nlitkowski 2021-12-20 02:41:48 +01:00
parent f8ed3cfd39
commit 713c263cab

View File

@ -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);