コード例 #1
0
        /****************************************************************************************************\
        * GameObject lifecycle methods																		*
        \****************************************************************************************************/
        void Awake()         // called before any Start methods
        {
            if (instance != null)
            {
                Debug.LogWarning("Another instance of FOVEInterface might be getting smashed by having multiple in one scene.");
            }
            instance = this;

            if (!_isStaticInitialized)
            {
                Debug.Log("No HMD detected, falling back to software emulation...");
                _f_state = new FOVEState_NoHMD();

                _isStaticInitialized = true;
            }

            if (leftEyeOverride != null)
            {
                _leftCamera       = leftEyeOverride;
                _leftCameraObject = _leftCamera.gameObject;
            }
            else
            {
                _leftCamera = SetupFoveViewCamera(-interpupilaryDistance * 0.5f, "Left", out _leftCameraObject);
            }

            if (rightEyeOverride != null)
            {
                _rightCamera       = rightEyeOverride;
                _rightCameraObject = _rightCamera.gameObject;
            }
            else
            {
                _rightCamera = SetupFoveViewCamera(interpupilaryDistance * 0.5f, "Right", out _rightCameraObject);
            }

            if (eyePrototype != null)
            {
                if (eyePrototype.gameObject.activeInHierarchy)
                {
                    eyePrototype.gameObject.SetActive(false);
                }
            }
        }
コード例 #2
0
        // called before any Start methods
        /****************************************************************************************************\
         * GameObject lifecycle methods																		*
        \****************************************************************************************************/
        void Awake()
        {
            if (instance != null)
            {
                Debug.LogWarning("Another instance of FOVEInterface might be getting smashed by having multiple in one scene.");
            }
            instance = this;

            if (!_isStaticInitialized)
            {
                Debug.Log("No HMD detected, falling back to software emulation...");
                _f_state = new FOVEState_NoHMD();

                _isStaticInitialized = true;
            }

            if (leftEyeOverride != null)
            {
                _leftCamera = leftEyeOverride;
                _leftCameraObject = _leftCamera.gameObject;
            }
            else
            {
                _leftCamera = SetupFoveViewCamera(-interpupilaryDistance * 0.5f, "Left", out _leftCameraObject);
            }

            if (rightEyeOverride != null)
            {
                _rightCamera = rightEyeOverride;
                _rightCameraObject = _rightCamera.gameObject;
            }
            else
            {
                _rightCamera = SetupFoveViewCamera(interpupilaryDistance * 0.5f, "Right", out _rightCameraObject);
            }

            if (eyePrototype != null)
            {
                if (eyePrototype.gameObject.activeInHierarchy)
                {
                    eyePrototype.gameObject.SetActive(false);
                }
            }
        }