protected void Update()
        {
            if (_shouldSetLocalPosition)
            {
                transform.localPosition = transform.forward * _deviceInfo.forwardOffset;
                _shouldSetLocalPosition = false;
            }

            if (Input.GetKeyDown(_recenter) &&
                XRSupportUtil.IsXREnabled() &&
                XRSupportUtil.IsXRDevicePresent())
            {
                XRSupportUtil.Recenter();
            }

            // Manual Time Alignment
            if (_allowManualTimeAlignment)
            {
                if (_unlockHold == KeyCode.None || Input.GetKey(_unlockHold))
                {
                    if (Input.GetKeyDown(_moreRewind))
                    {
                        _customWarpAdjustment += 1;
                    }
                    if (Input.GetKeyDown(_lessRewind))
                    {
                        _customWarpAdjustment -= 1;
                    }
                }
            }
        }
Example #2
0
        private void Start()
        {
            _lastKnownHeightOffset = _roomScaleHeightOffset;

            if (XRSupportUtil.IsRoomScale())
            {
                this.transform.position -= this.transform.up * _roomScaleHeightOffset;
            }

            if (recenterOnStart)
            {
                XRSupportUtil.Recenter();
            }
        }
Example #3
0
        private void Update()
        {
            if (Application.isPlaying)
            {
                var deviceIsPresent = XRSupportUtil.IsXRDevicePresent();
                if (deviceIsPresent)
                {
                    if (enableRuntimeAdjustment)
                    {
                        if (Input.GetKeyDown(stepUpKey))
                        {
                            roomScaleHeightOffset += stepSize;
                        }

                        if (Input.GetKeyDown(stepDownKey))
                        {
                            roomScaleHeightOffset -= stepSize;
                        }
                    }

                    if (recenterOnUserPresence && !XRSupportUtil.IsRoomScale())
                    {
                        var userPresence = XRSupportUtil.IsUserPresent();

                        if (_lastUserPresence != userPresence)
                        {
                            if (userPresence)
                            {
                                XRSupportUtil.Recenter();
                            }

                            _lastUserPresence = userPresence;
                        }
                    }

                    if (recenterOnKey && Input.GetKeyDown(recenterKey))
                    {
                        XRSupportUtil.Recenter();
                    }
                }
            }
        }