void OnFocusButtonClicked()
        {
            var selectedObj = ((ObjectSelectionInfo)m_ObjectSelectionInfoSelector.GetValue()).CurrentSelectedObject();

            if (selectedObj != null)
            {
                Vector3 focusPoint  = selectedObj.transform.position;
                var     childBounds = selectedObj.CalculateBoundsInChildren();
                if (childBounds.HasValue)
                {
                    focusPoint = childBounds.Value.center;
                }

                if (!m_VREnableSelector.GetValue())
                {
                    m_Camera.FocusOnPoint(focusPoint);
                }
                else
                {
                    var camTransform = Camera.main.transform;
                    var xrRig        = camTransform.GetComponentInParent <XRRig>();

                    SetFocusCameraPosition(xrRig, focusPoint);
                    var direction = (focusPoint - camTransform.position).normalized;
                    xrRig.MatchRigUpRigForward(Vector3.up, direction);
                }
            }
        }
Esempio n. 2
0
        void OnFocusButtonClicked()
        {
            var selectedObj = UIStateManager.current.projectStateData.objectSelectionInfo.CurrentSelectedObject();

            if (selectedObj != null)
            {
                Vector3 focusPoint  = selectedObj.transform.position;
                var     childBounds = selectedObj.CalculateBoundsInChildren();
                if (childBounds.HasValue)
                {
                    focusPoint = childBounds.Value.center;
                }
                m_Camera.FocusOnPoint(focusPoint);
            }
        }