コード例 #1
0
        protected override IEnumerator CoUpdate()
        {
            _guiCalibration.gameObject.SetActive(true);

            if (QuickVRManager.IsXREnabled())
            {
//#if UNITY_ANDROID
//                if (_hTracking._handTrackingMode == QuickUnityVR.HandTrackingMode.Hands)
//                {
//                    _guiCalibration.SetCalibrationInstructions(QuickUserGUICalibration.CalibrationStep.HandTrackingMode);

//                    while (!InputManager.GetButtonDown(InputManager.DEFAULT_BUTTON_CONTINUE))
//                    {
//                        yield return null;
//                    }
//                }
//#endif
                _guiCalibration.SetCalibrationInstructions(QuickUserGUICalibration.CalibrationStep.HMDAdjustment);
                yield return(new WaitForSeconds(0.5f));

                //HMD Adjustment
                while (!InputManager.GetButtonDown(InputManager.DEFAULT_BUTTON_CONTINUE))
                {
                    yield return(null);
                }

                yield return(null);
            }

            _guiCalibration.gameObject.SetActive(false);
        }
コード例 #2
0
        public virtual void Enable(bool enable, bool clearTextOnEnable = true)
        {
            if (enable)
            {
                Animator animator = QuickSingletonManager.GetInstance <QuickVRManager>().GetAnimatorTarget();
                if (animator)
                {
                    Vector2   hSize = GetComponent <RectTransform>().GetSizeHalf();
                    Transform t     = QuickVRManager.IsXREnabled() ? animator.transform : Camera.main.transform;
                    Vector3   pos   = animator.GetBoneTransform(HumanBodyBones.Head).position;
                    transform.position = pos - (t.right * hSize.x) + (t.up * hSize.y) + t.forward * 2;
                    transform.rotation = t.rotation;
                }
            }

            foreach (Transform t in transform)
            {
                t.gameObject.SetActive(enable);
            }

            if (enable && clearTextOnEnable)
            {
                SetText("");
            }

            if (!QuickVRManager.IsXREnabled())
            {
                InputManagerKeyboard iManager = QuickSingletonManager.GetInstance <InputManager>().GetComponentInChildren <InputManagerKeyboard>();
                iManager.enabled = !enable;
                _rootKeys.gameObject.SetActive(false);
            }

            _isEnabled = enable;
        }
コード例 #3
0
        protected virtual Ray ComputeRay()
        {
            if (!QuickVRManager.IsXREnabled() && GetVRCursor(Role.Head) == this)
            {
                return(QuickVRCameraController.GetCamera().ScreenPointToRay(new Vector3(_mouse.position.x.ReadValue(), _mouse.position.y.ReadValue())));
            }

            return(new Ray(transform.position, _CursorTransform.position - transform.position));
        }
コード例 #4
0
        protected virtual void OnDisable()
        {
            _vrPlayArea.GetVRNode(HumanBodyBones.Head).OnCalibrateVRNode      -= OnCalibrateVRNodeHead;
            _vrPlayArea.GetVRNode(HumanBodyBones.Hips).OnCalibrateVRNode      -= OnCalibrateVRNodeHips;
            _vrPlayArea.GetVRNode(HumanBodyBones.LeftHand).OnCalibrateVRNode  -= OnCalibrateVRNodeLeftHand;
            _vrPlayArea.GetVRNode(HumanBodyBones.RightHand).OnCalibrateVRNode -= OnCalibrateVRNodeRightHand;
            _vrPlayArea.GetVRNode(HumanBodyBones.LeftFoot).OnCalibrateVRNode  -= OnCalibrateVRNodeFoot;
            _vrPlayArea.GetVRNode(HumanBodyBones.RightFoot).OnCalibrateVRNode -= OnCalibrateVRNodeFoot;

            if (!QuickVRManager.IsXREnabled())
            {
                QuickVRManager.OnPostUpdateIKTargets -= UpdateHeadRotationMono;
            }
        }
コード例 #5
0
        protected override IEnumerator CoUpdate()
        {
            _guiCalibration.gameObject.SetActive(true);

            //Show the logos if any
            yield return(StartCoroutine(CoShowLogos()));

            if (QuickVRManager.IsXREnabled())
            {
                yield return(StartCoroutine(CoUpdateStateForwardDirection()));    //Wait for the VR Devices Calibration
            }

            _guiCalibration.gameObject.SetActive(false);
            _vrManager.RequestCalibration();
        }
コード例 #6
0
        protected override void OnEnable()
        {
            base.OnEnable();

            _vrPlayArea.GetVRNode(HumanBodyBones.Head).OnCalibrateVRNode      += OnCalibrateVRNodeHead;
            _vrPlayArea.GetVRNode(HumanBodyBones.Hips).OnCalibrateVRNode      += OnCalibrateVRNodeHips;
            _vrPlayArea.GetVRNode(HumanBodyBones.LeftHand).OnCalibrateVRNode  += OnCalibrateVRNodeLeftHand;
            _vrPlayArea.GetVRNode(HumanBodyBones.RightHand).OnCalibrateVRNode += OnCalibrateVRNodeRightHand;
            _vrPlayArea.GetVRNode(HumanBodyBones.LeftFoot).OnCalibrateVRNode  += OnCalibrateVRNodeFoot;
            _vrPlayArea.GetVRNode(HumanBodyBones.RightFoot).OnCalibrateVRNode += OnCalibrateVRNodeFoot;

            if (!QuickVRManager.IsXREnabled())
            {
                QuickVRManager.OnPostUpdateIKTargets += UpdateHeadRotationMono;
            }
        }
コード例 #7
0
        protected virtual void Update()
        {
            if (!QuickVRManager.IsXREnabled())
            {
                UpdateKeyboardMono();
            }

            _textInput.text = _text;
            if (_timeBlinking < _blinkTime)
            {
                _textInput.text += "|";
            }

            _timeBlinking += Time.deltaTime;
            if (_timeBlinking > _blinkTime * 2)
            {
                _timeBlinking = 0;
            }
        }
コード例 #8
0
        protected virtual void Awake()
        {
            if (!Camera.main)
            {
                Camera camera = _pfCamera ? Instantiate <Camera>(_pfCamera) : new GameObject().GetOrCreateComponent <Camera>();
                camera.name = "__Camera__";
                camera.tag  = "MainCamera";
                camera.gameObject.GetOrCreateComponent <FlareLayer>();
            }

            _camera = Camera.main;
            _camera.transform.parent = transform;
            _camera.transform.ResetTransformation();
            _camera.GetOrCreateComponent <AudioListener>();

            if (!QuickVRManager.IsXREnabled())
            {
                _camera.fieldOfView = 70.0f;//90.0f;
            }

            QuickUICursor.CreateVRCursor(QuickUICursor.Role.Head, _camera.transform);
        }
コード例 #9
0
 public static QuickUICursor GetVRCursorMain()
 {
     return(GetVRCursor(QuickVRManager.IsXREnabled() ? Role.RightHand : Role.Head));
 }