rabidus-test/Assets/HapticsEffect.cs

29 lines
716 B
C#
Raw Permalink Normal View History

2023-10-19 11:04:15 +03:00
using BNG;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class VibrationSettings
{
public float Frequency;
public float Amplitude;
public float Duration;
}
public class HapticsEffect : MonoBehaviour
{
private InputBridge inputBridge;
private void Awake()
{
inputBridge = GetComponent<InputBridge>();
}
public void Vibrate(VibrationSettings vibration)
{
inputBridge.VibrateController(vibration.Frequency, vibration.Amplitude, vibration.Duration, ControllerHand.Left);
inputBridge.VibrateController(vibration.Frequency, vibration.Amplitude, vibration.Duration, ControllerHand.Right);
}
}