// Use this for initialization void Start() { perspective = GetComponentInChildren<RTexCameraPosition>(); persp = GetComponentInChildren<CameraRenderPosition>(); if (perspective == null && persp == null) { Debug.LogError("No RTexCameraPosition or CameraRenderPosition script attached to child."); return; } }
// Use this for initialization void Start() { // Get relative variables for script use _player = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Transform>(); _playerCam = _player.GetComponent<Camera>(); _defaultRot = Moveable.rotation.eulerAngles; _playerBase = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>(); _normalisedDefaultRot = new Vector3(0, _defaultRot.y, 0); _cam = GetComponent<Camera>(); _cam.fieldOfView = _player.GetComponent<Camera>().fieldOfView; // Get the positions of the area bounds _bounds = new Vector3[Bounds.Length]; for (int i = 0; i < Bounds.Length; i++) { _bounds[i] = Bounds[i].position; } // If there are requests for additional render depths, create the requirements _additionalDepthRenderers = new GameObject[Helper.renderDepth]; for (int i = 0; i < Helper.renderDepth; i++) { _additionalDepthRenderers[i] = Instantiate(Moveable.gameObject); _additionalDepthRenderers[i].GetComponentInChildren<CameraRenderPosition>().enabled = false; _additionalDepthRenderers[i].GetComponentInChildren<Camera>().depth = -(i + 2); _additionalDepthRenderers[i].transform.parent = Moveable.parent; } // Get rotation Quaternions between the two points _relativePlayerRot = Quaternion.FromToRotation(RenderPosition.forward, -PointOfView.forward); _relativePortalRot = Quaternion.FromToRotation(RenderPosition.forward, PointOfView.forward); // Get external script references _linkedScript = PointOfView.GetComponentInChildren<CameraRenderPosition>(); _playerControl = _player.GetComponentInParent<OVRPlayerController>(); }