public static void SupportCardboard() { #if __SDK_VR_GOOGLE__ if (null != device_) { return; } CanvasMgr.Toggle2D(false); CanvasMgr.ToggleEvent(false); CameraMgr.ToggleCamera(false); device_ = new GameObject("__gvr__").transform; device_.SetParent(root_); Transform tsHead = new GameObject("head").transform; tsHead.SetParent(device_); Transform tsCamera = new GameObject("camera").transform; tsCamera.tag = "MainCamera"; tsCamera.SetParent(tsHead); CameraMgr.InjectOuterCamera(tsHead); /* * // Transform tsCamera = CameraMgr.camera; * GvrViewer viewer = device_.gameObject.AddComponent<GvrViewer>(); * viewer.VRModeEnabled = true; * viewer.DistortionCorrection = GvrViewer.DistortionCorrectionMethod.Native; * viewer.StereoScreenScale = 1f; * viewer.NeckModelScale = 0f; * * reticle_ = Object.Instantiate<GameObject>(Resources.Load<GameObject>("VR/XReticle")); * reticle_.name = "Reticle"; * reticle_.transform.SetParent(device_); * * GvrReticlePointer reticle = reticle_.AddComponent<GvrReticlePointer>(); * reticle.reticleSegments = 20; * reticle.reticleGrowthSpeed = 8; * reticle_.transform.SetParent(tsCamera); * * event_ = new GameObject("EventSystem"); * event_.transform.SetParent(device_.transform); * event_.AddComponent<GvrPointerManager>(); * event_.AddComponent<GvrPointerInputModule>(); * tsCamera.gameObject.AddComponent<PhysicsRaycaster>(); * * XGaze.instance.transform.SetParent(reticle.transform); */ XGaze.instance.transform.localPosition = Vector3.zero; XGaze.instance.transform.localRotation = Quaternion.identity; XGaze.instance.transform.localScale = Vector3.one; //SightTrigger.SupportCardboard(); #endif }
public static void SupportMI() { #if __SDK_VR_XIAOMI__ if (null != device_) { return; } //close 2d canvas CanvasMgr.Toggle2D(false); //close standalone input event CanvasMgr.ToggleEvent(false); device_ = new GameObject("__mivr__").transform; device_.SetParent(root_); GameObject leftEye = new GameObject("LeftEye"); leftEye.transform.SetParent(device_); Camera leftEyeCamera = leftEye.AddComponent <Camera>(); leftEyeCamera.nearClipPlane = 0.1f; GameObject rightEye = new GameObject("RightEye"); rightEye.transform.SetParent(device_); Camera rightEyeCamera = rightEye.AddComponent <Camera>(); rightEyeCamera.nearClipPlane = 0.1f; addXRectiel(device_); device_.gameObject.AddComponent <MiCamera>(); device_.gameObject.AddComponent <VrManager>(); device_.gameObject.AddComponent <MIInputManager>(); CameraMgr.InjectOuterCamera(device_); ///XGaze.instance.transform.SetParent(reticle.transform); XGaze.instance.transform.localPosition = Vector3.zero; XGaze.instance.transform.localRotation = Quaternion.identity; XGaze.instance.transform.localScale = Vector3.one; #endif }