private void EnableCameras(bool tutorial = false, bool makeVisible = true) { if (domStrings != null) { domStrings.cam = topCamera.transform; //domStrings.scaleMultiplier = 0.0005f; } Vector3 eventCenterPos = eventPlayer.GetEventCenterpoint(tutorial ? 0 : -1); Bounds b = eventPlayer.GetEventBounds(eventCenterPos, tutorial ? 0 : -1); // Front Camera //frontCamera.transform.position = Camera.main.transform.position; frontCamera.transform.rotation = Camera.main.transform.rotation; frontCamera.transform.RotateAround(eventCenterPos, UnityEngine.Camera.main.transform.right.normalized, Mathf.Rad2Deg * (Mathf.PI / 2f - Mathf.Acos(Vector3.Dot(Camera.main.transform.forward.normalized, Vector3.up)))); frontCamera.transform.position = b.center - frontCamera.transform.forward.normalized * b.extents.z; //forward = frontCamera.transform.forward.normalized; //endQ = frontCamera.transform.rotation; //frontCamera.transform.position = Camera.main.transform.position; //frontCamera.transform.rotation = Camera.main.transform.rotation; frontCamera.GetComponent <Camera>().orthographicSize = Mathf.Max(b.extents.x, b.extents.y) + 70.0f; //StartCoroutine(Transition(Camera.main.transform.position, b.center - forward * (Mathf.Tan((topCamera.GetComponent<Camera>().fieldOfView * Mathf.Deg2Rad) * 0.5f) * Mathf.Max(b.extents.x, b.extents.y)) - forward * b.extents.z, // Camera.main.transform.rotation, endQ, frontCamera)); // Top Camera //topCamera.transform.position = Camera.main.transform.position; topCamera.transform.rotation = Camera.main.transform.rotation; topCamera.transform.RotateAround(eventCenterPos, UnityEngine.Camera.main.transform.right.normalized, Mathf.Rad2Deg * (Mathf.PI - Mathf.Acos(Vector3.Dot(Camera.main.transform.forward.normalized, Vector3.up)))); topCamera.transform.position = b.center + new Vector3(0f, b.extents.y, 0f); Quaternion endQ = topCamera.transform.rotation; //topCamera.transform.position = Camera.main.transform.position; //topCamera.transform.rotation = Camera.main.transform.rotation; topCamera.GetComponent <Camera>().orthographicSize = Mathf.Max(b.extents.x, b.extents.z) + 100.0f; if (makeVisible) { panelParent.SetActive(true); } StartCoroutine(Transition(frontCamera.transform.position, b.center + new Vector3(0f, b.extents.y, 0f), frontCamera.transform.rotation, endQ, topCamera)); //StartCoroutine(Transition(Camera.main.transform.position, b.center + // new Vector3(0f, Mathf.Tan((topCamera.GetComponent<Camera>().fieldOfView * Mathf.Deg2Rad) * 0.5f) * Mathf.Max(b.extents.x, b.extents.z) + b.extents.y, 0f), // Camera.main.transform.rotation, endQ, topCamera)); // Side Camera //sideCamera.transform.position = Camera.main.transform.position; sideCamera.transform.rotation = Camera.main.transform.rotation; sideCamera.transform.RotateAround(eventCenterPos, UnityEngine.Camera.main.transform.right.normalized, Mathf.Rad2Deg * (Mathf.PI / 2f - Mathf.Acos(Vector3.Dot(Camera.main.transform.forward.normalized, Vector3.up)))); sideCamera.transform.RotateAround(eventCenterPos, Vector3.up, 90f); endQ = sideCamera.transform.rotation; sideCamera.transform.position = b.center - sideCamera.transform.forward.normalized * b.extents.x; //Vector3 forward = sideCamera.transform.forward.normalized; //sideCamera.transform.position = Camera.main.transform.position; //sideCamera.transform.rotation = Camera.main.transform.rotation; sideCamera.GetComponent <Camera>().orthographicSize = Mathf.Max(b.extents.y, b.extents.z) + 100.0f; StartCoroutine(Transition(frontCamera.transform.position, b.center - sideCamera.transform.forward.normalized * b.extents.x, frontCamera.transform.rotation, endQ, sideCamera)); //StartCoroutine(Transition(Camera.main.transform.position, b.center - forward * (Mathf.Tan((topCamera.GetComponent<Camera>().fieldOfView * Mathf.Deg2Rad) * 0.5f) * Mathf.Max(b.extents.y, b.extents.z)) - forward * b.extents.x, // Camera.main.transform.rotation, endQ, sideCamera)); if (isSoft) { softTutorialText.GetComponent <UnityEngine.UI.Text>().text = "Good, now do the same in the top, front and side views."; } }