void Update()
        {
            if (PrimaryDeviceDetection.PrimaryIndex < 0)
            {
                return;
            }

            float mappedPressureValue = PrimaryDeviceDetection.GetPrimaryInput().GetAxis(_input).x;

            if (mappedPressureValue > 0)
            {
                mappedPressureValue = _mappedCurve.Evaluate(mappedPressureValue);
            }
            _circleIndicatorRenderer.sharedMaterial.SetFloat("_BackgroundCutoff", 1 - mappedPressureValue);
        }
        void Update()
        {
            if (PrimaryDeviceDetection.PrimaryIndex < 0)
            {
                return;
            }

            if (PrimaryDeviceDetection.GetPrimaryInput().GetPressDown(_input))
            {
                Material[] mats = _targetRenderer.sharedMaterials;
                _defaultMaterial = mats[0];
                mats[0]          = _newMaterial;
                _targetRenderer.sharedMaterials = mats;
            }

            if (PrimaryDeviceDetection.GetPrimaryInput().GetPressUp(_input))
            {
                Material[] mats = _targetRenderer.sharedMaterials;
                mats[0] = _defaultMaterial;
                _targetRenderer.sharedMaterials = mats;
            }
        }
Ejemplo n.º 3
0
        private void Update()
        {
            if (PrimaryDeviceDetection.PrimaryIndex < 0)
            {
                return;
            }

            if (PrimaryDeviceDetection.GetPrimaryInput().GetTouchDown(EVRButtonId.k_EButton_SteamVR_Touchpad))
            {
                _touchRepresentation.gameObject.SetActive(true);
            }

            if (PrimaryDeviceDetection.GetPrimaryInput().GetTouch(EVRButtonId.k_EButton_SteamVR_Touchpad))
            {
                Vector2 touchPosition = PrimaryDeviceDetection.GetPrimaryInput().GetAxis(_touchInput) / 2;
                _touchRepresentation.localPosition = touchPosition;
            }

            if (PrimaryDeviceDetection.GetPrimaryInput().GetTouchUp(EVRButtonId.k_EButton_SteamVR_Touchpad))
            {
                _touchRepresentation.gameObject.SetActive(false);
            }
        }