示例#1
0
        protected virtual void Setup2DCamera()
        {
            if (_2DCamera == null)
            {
                _2DCamera     = new GameObject("2D Camera").AddComponent <Camera>();
                _base2DCamera = _2DCamera.gameObject.AddComponent <TBCamera2D>();
                _2DCamera.transform.MakeZeroedChildOf(_trackingVolume);
                _base2DCamera.Initialize();
            }

            _base2DCamera.transform.localRotation = Quaternion.identity;
        }
示例#2
0
        private void SetupNativeCamera(VRPlatform platform)
        {
            _centerEyeTransform = new GameObject().transform;
            _centerEyeTransform.MakeZeroedChildOf(_trackingVolume);
            _centerEyeTransform.gameObject.name = "Standard VR Camera";
            _centerEyeTransform.gameObject.tag  = "MainCamera";
            _primaryCamera = _centerEyeTransform.gameObject.AddComponent <Camera>();
            switch (platform)
            {
            case VRPlatform.OculusMobile:
            case VRPlatform.OculusPC:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraOculus>();
                break;

            case VRPlatform.SteamVR:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBSteamVRCamera>();
                break;

                #if TB_HAS_UNITY_PS4
            case VRPlatform.PlayStationVR:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraPSVR>();
                break;
                #endif
            case VRPlatform.Daydream:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraGoogle>();
                break;

            default:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraBase>();
                break;
            }
            _baseCamera.Initialize();

            if (TBTracking.OnNodeConnected != null)
            {
                TBTracking.OnNodeConnected(UnityEngine.XR.XRNode.CenterEye, _centerEyeTransform);
                TBTracking.OnNodeConnected(UnityEngine.XR.XRNode.Head, _centerEyeTransform);
                TBTracking.OnNodeConnected(UnityEngine.XR.XRNode.TrackingReference, _trackingVolume);
            }

            _trackingVolume.localScale = Vector3.one;
        }
示例#3
0
        private void SetupNativeCamera(VRPlatform platform)
        {
            _primaryCamera = _centerEyeTransform.gameObject.AddComponent <Camera>();
            switch (platform)
            {
            case VRPlatform.OculusMobile:
            case VRPlatform.OculusPC:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraOculus>();
                break;

            case VRPlatform.SteamVR:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBSteamVRCamera>();
                break;

                    #if TB_HAS_UNITY_PS4
            case VRPlatform.PlayStationVR:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraPSVR>();
                break;
                    #endif
            case VRPlatform.Daydream:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraGoogle>();
                break;

            default:
                _cameraMode = CameraMode.Single;
                _baseCamera = _primaryCamera.gameObject.AddComponent <TBCameraBase>();
                break;
            }
            _baseCamera.Initialize();

            _trackingVolume.localScale = Vector3.one;
        }