private IEnumerator RotateAndCapture() // for loop based on elevation angle + azim angle + dist value { for (int x = minDist; x <= maxDist; x += increment1) { transform.Translate(0, 0, transform.position.z - x); Debug.Log("POSITION: " + transform.position); for (int v = minAzimAngle; v <= maxAzimAngle; v += increment3) { transform.RotateAround(target, Vector3.up, increment3); for (int c = minElevAngle; c <= maxElevAngle; c += increment2) { Vector3 temp = transform.rotation.eulerAngles; temp.x = c; transform.rotation = Quaternion.Euler(temp); for (int w = minObjRot; w <= maxObjRot; w += increment4) { foreach (Transform t in models) { Vector3 temp2 = t.rotation.eulerAngles; temp2.y = w; t.rotation = Quaternion.Euler(temp2); } string imageName = "Light" + GameManager.SliderValue + "_D" + x + "_Azim" + v + "_Elev" + c + "_ObjRot" + w + "_Scene" + sceneInd + "_" + index + ".png"; T1.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path + imageName)); yield return(new WaitForSeconds(.05f)); Camera1.enabled = false; Camera2.enabled = true; T2.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path2 + imageName)); yield return(new WaitForSeconds(.05f)); Camera2.enabled = false; Camera3.enabled = true; T3.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path3 + imageName)); yield return(new WaitForSeconds(.05f)); Camera3.enabled = false; Camera1.enabled = true; index++; } } } } panel2.SetActive(true); Debug.Log("YOURE DONE"); }
private IEnumerator RotateAndCapture() // for loop based on elevation angle + azim angle + dist value { Vector3 outCart; for (int x = minDist; x <= maxDist; x += increment1) { for (int v = minAzimAngle; v <= maxAzimAngle; v += increment3) { for (int c = minElevAngle; c <= maxElevAngle; c += increment2) { float eef = (float)(3.14 / 180.0) * (float)(90 - c); float ppf = (float)(3.14 / 180.0) * (float)v; SphericalToCartesian((float)x, ppf, eef, out outCart); //print(outCart); // Instantiate at position <outCart> and zero rotation. //Instantiate(myPrefab, outCart, Quaternion.identity); transform.position = outCart; transform.rotation = Quaternion.LookRotation(Vector3.zero); Debug.Log("POSIITON:" + transform.position); for (int w = minObjRot; w <= maxObjRot; w += increment4) { foreach (Transform t in models) { Vector3 temp2 = t.rotation.eulerAngles; temp2.y = w; t.rotation = Quaternion.Euler(temp2); } string elevValue = (90 - c).ToString(); string imageName = "Light" + GameManager.SliderValue + "_D" + x + "_Azim" + v + "_Elev" + elevValue + "_ObjRot" + w + "_Scene" + sceneInd + "_" + index + ".png"; T1.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path + imageName)); yield return(new WaitForSeconds(.05f)); Camera1.enabled = false; Camera2.enabled = true; T2.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path2 + imageName)); yield return(new WaitForSeconds(.05f)); Camera2.enabled = false; Camera3.enabled = true; T3.LookAt(target); ScreenCapture.CaptureScreenshot(Path.Combine(path3 + imageName)); yield return(new WaitForSeconds(.05f)); Camera3.enabled = false; Camera1.enabled = true; index++; } } } } panel2.SetActive(true); Debug.Log("YOURE DONE"); }