/// <summary>
 /// Sends instructions pack for vibration engine to the controller node. Every next instruction will be work after previous one end.
 /// </summary>
 /// <param name="vibrationPackage">instructions pack for vibration engine</param>
 public void HapticPulse(params VibrationPackage[] vibrationPackage)
 {
     FinchVR.HapticPulse(NodeType, vibrationPackage);
 }
        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 = 0.01f;
                float z = TouchpadPointYOffset + TouchpadRadius * controller.GetTouchAxes().y;
                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;
            }

            if (controller.GetPress(FinchControllerElement.ButtonThumb))
            {
                Vector3 scale = TouchpadPointDimensions;
                scale.x = TouchpadRadius * 4;
                scale.z = TouchpadRadius * 4;

                transform.localScale = scale;

                float x = 0f;
                float y = 0.01f;
                float z = TouchpadPointYOffset;
                transform.localPosition = new Vector3(x, y, z);
            }

            elapsedScaleTimeSeconds += Time.deltaTime;
        }
 /// <summary>
 /// Sends vibration signal to the controller node. There will be vibration in certain milliseconds time, but not more than 2500 ms.
 /// </summary>
 /// <param name="millisecond">Certain milliseconds time, but not more than 2500 ms</param>
 public void HapticPulse(uint millisecond)
 {
     FinchVR.HapticPulse(NodeType, millisecond);
 }
Exemple #4
0
 void Awake()
 {
     FinchVR.SetCamera(Camera != null ? Camera : UnityEngine.Camera.main.transform);
     FinchSettings.InitPlayerSettings();
     FinchSettings.InitSceneSettings(HeadUpdateType, ControllersCount, BodyRotationMode, RecenterMode);
 }