Example #1
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateDataForSize(ICursorDataForInput pData,
                                       HoverInputVive.ControlState pState)
        {
            float prog = GetInputSourceProgress(CursorSizeInput, pState, 0.5f);

            pData.SetSize(Mathf.Lerp(MinSize, MaxSize, prog));
        }
Example #2
0
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateDataForTrigger(ICursorDataForInput pData,
                                          HoverInputVive.ControlState pState)
        {
            float prog = GetInputSourceProgress(TriggerStrengthInput, pState, 0);

            pData.SetTriggerStrength(prog);
        }
Example #3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        private void UpdateDataWithLocalOffsets(ICursorDataForInput pData,
                                                HoverInputVive.ControlState pState)
        {
            Vector3 worldOffset = pState.Tx.TransformVector(LocalPosition);

            pData.SetWorldPosition(pState.Tx.position + worldOffset);
            pData.SetWorldRotation(pState.Tx.rotation * Quaternion.Euler(LocalRotation));
        }
Example #4
0
        /*--------------------------------------------------------------------------------------------*/
        private float GetInputSourceProgress(InputSourceType pInputSourceType,
                                             HoverInputVive.ControlState pState, float pDefault)
        {
            switch (pInputSourceType)
            {
            case InputSourceType.Trigger:
                return(Mathf.InverseLerp(0, IndexTriggerMax, pState.TriggerAxis.x));

            case InputSourceType.TouchpadY:
                return(Mathf.InverseLerp(-TouchpadMax, TouchpadMax, pState.TouchpadAxis.y));

            case InputSourceType.TouchpadUp:
                return(Mathf.InverseLerp(0, TouchpadMax, pState.TouchpadAxis.y));

            case InputSourceType.TouchpadDown:
                return(Mathf.InverseLerp(0, -TouchpadMax, pState.TouchpadAxis.y));

            case InputSourceType.TouchpadX:
                return(Mathf.InverseLerp(-TouchpadMax, TouchpadMax, pState.TouchpadAxis.x));

            case InputSourceType.TouchpadLeft:
                return(Mathf.InverseLerp(0, -TouchpadMax, pState.TouchpadAxis.x));

            case InputSourceType.TouchpadRight:
                return(Mathf.InverseLerp(0, TouchpadMax, pState.TouchpadAxis.x));

            case InputSourceType.TouchpadTouch:
                return(pState.TouchpadTouch ? 1 : 0);

            case InputSourceType.TouchpadPress:
                return(pState.TouchpadPress ? 1 : 0);

            case InputSourceType.GripPress:
                return(pState.GripPress ? 1 : 0);

            case InputSourceType.MenuPress:
                return(pState.MenuPress ? 1 : 0);
            }

            return(pDefault);
        }
Example #5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        public void UpdateData(HoverCursorDataProvider pCursorDataProv,
                               HoverInputVive.ControlState pState)
        {
            ICursorDataForInput data = GetData(pCursorDataProv);

            if (data == null)
            {
                return;
            }

            data.SetUsedByInput(pState.IsValid);

            if (!pState.IsValid)
            {
                return;
            }

            UpdateDataWithLocalOffsets(data, pState);
            UpdateDataForTrigger(data, pState);
            UpdateDataForSize(data, pState);
        }