public void OnBackgroundClicked()
    {
        var position = Input.mousePosition;

        FocusPoint.SetActive(true);
        FocusPoint.GetComponent <RectTransform>().position = position;

        Camera.ExposeAtPointOfInterest(position, CaptureExposureMode.ContinuousAutoExpose);
        Camera.FocusAtPointOfInterest(position);
    }
示例#2
0
    public void OnBackgroundClicked()
    {
        /* The background is a UI component that covers the entire screen and is triggered when no other control was pressed.
         * It is used to trigger focus and expose at point of interest commands.
         */

        /* When checking if a certain camera feature is supported, the SDK will report an error if it is not, indicating the reason.
         * Since we are not interested in the reason, we temporarily suppress error handling until the end of the method.
         */
        _suppressErrors = true;
        bool isFocusAtPointOfInterestSupported  = Camera.IsFocusAtPointOfInterestSupported;
        bool isExposeAtPointOfInterestSupported = Camera.IsExposeAtPointOfInterstSupported;

        if (isFocusAtPointOfInterestSupported || isExposeAtPointOfInterestSupported)
        {
            var position = Input.mousePosition;
            FocusPoint.SetActive(true);
            FocusPoint.GetComponent <RectTransform>().position = position;

            if (Camera.IsFocusAtPointOfInterestSupported)
            {
                Camera.FocusAtPointOfInterest(position);
            }

            if (isExposeAtPointOfInterestSupported)
            {
                Camera.ExposeAtPointOfInterest(position, CaptureExposureMode.ContinuousAutoExpose);
            }
        }
        else
        {
            FocusPoint.SetActive(false);
        }

        StartCoroutine(EnableErrors());
    }