Beispiel #1
0
        void CreateMixedRealityRender()
        {
            HMDCamera.enabled = false;
            HMDCamera.gameObject.SetActive(false);
            var hmdCameraClone = Instantiate(HMDCamera.gameObject);

            HMDCamera.gameObject.SetActive(true);
            HMDCamera.enabled = true;

            hmdCameraClone.name = "LIV Camera";

            // Remove all children from camera clone.
            while (hmdCameraClone.transform.childCount > 0)
            {
                DestroyImmediate(hmdCameraClone.transform.GetChild(0).gameObject);
            }

            DestroyImmediate(hmdCameraClone.GetComponent("AudioListener"));
            DestroyImmediate(hmdCameraClone.GetComponent("MeshCollider"));

            if (SteamVRCompatibility.IsAvailable)
            {
                DestroyImmediate(hmdCameraClone.GetComponent(SteamVRCompatibility.SteamVRCamera));
                DestroyImmediate(hmdCameraClone.GetComponent(SteamVRCompatibility.SteamVRFade));
            }

            _mixedRealityRender             = hmdCameraClone.AddComponent <MixedRealityRender>();
            hmdCameraClone.transform.parent = _externalCamera.transform;

            hmdCameraClone.SetActive(true);

            _mixedRealityRender.Setup(this);
        }
Beispiel #2
0
        void DestroyMixedRealityRender()
        {
            if (_mixedRealityRender != null)
            {
                Destroy(_mixedRealityRender.gameObject);

                _mixedRealityRender = null;
            }
        }