private void Update()
        {
            FinchController controller = FinchVR.GetFinchController(Chirality);

            if (controller == null)
            {
                return;
            }

            HandleMaterialChange(controller, TriggerRenderer, 0, TriggerPressed, TriggerUnpressed, FinchControllerElement.IndexTrigger);
            TriggerAnimation(controller, FinchControllerElement.IndexTrigger, TriggerObject);
            HandleMaterialChange(controller, VolumeRenderer, 1, VolumePlusPressed, VolumePlusUnpressed, FinchControllerElement.ButtonThree);
            HandleMaterialChange(controller, VolumeRenderer, 2, VolumeMinusPressed, VolumeMinusUnpressed, FinchControllerElement.ButtonTwo);
            HandleMaterialChange(controller, HomeButtonRenderer, 0, HomeCalibrationButtonPressed, HomeCalibrationButtonUnpressed, FinchControllerElement.ButtonZero);
            HandleMaterialChange(controller, AppButtonRenderer, 1, AppButtonPressed, AppButtonUnpressed, FinchControllerElement.ButtonOne);
        }
Exemplo n.º 2
0
        void Update()
        {
            FinchController controller = FinchVR.GetFinchController(Chirality);

            if (touchRenderer == null || controller == null)
            {
                return;
            }

            touchRenderer.material = TouchOpaque;

            if (controller.IsTouching())
            {
                if (!wasTouching)
                {
                    wasTouching             = true;
                    elapsedScaleTimeSeconds = 0.0f;
                }

                Vector3 scale = Vector3.Lerp(Vector3.zero,
                                             TouchpadPointDimensions,
                                             elapsedScaleTimeSeconds / TouchpadPointScaleDurationSeconds);

                transform.localScale = scale;

                float x = TouchpadRadius * controller.GetTouchAxes().x;
                float y = TouchpadPointYOffset + TouchpadRadius * controller.GetTouchAxes().y;
                float z = 3.8f;
                transform.localPosition = new Vector3(x, y, z);
            }
            else
            {
                if (wasTouching)
                {
                    wasTouching             = false;
                    elapsedScaleTimeSeconds = 0.0f;
                }

                Vector3 scale = Vector3.Lerp(TouchpadPointDimensions,
                                             Vector3.zero,
                                             elapsedScaleTimeSeconds / TouchpadPointScaleDurationSeconds);

                transform.localScale = scale;
            }

            elapsedScaleTimeSeconds += Time.deltaTime;
        }