2022-08-12 02:20:00 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.XR;
|
2022-08-22 04:21:51 +02:00
|
|
|
public class ControllerHapticManager : MonoBehaviour
|
2022-08-12 02:20:00 +02:00
|
|
|
{
|
|
|
|
public XRNode Hand;
|
|
|
|
InputDevice device;
|
2022-08-26 22:06:45 +02:00
|
|
|
public float duration = 0.1f;
|
|
|
|
public float amplitude = 1f;
|
2022-08-12 02:20:00 +02:00
|
|
|
private void OnTriggerEnter(Collider other)
|
|
|
|
{
|
|
|
|
device = InputDevices.GetDeviceAtXRNode(Hand);
|
|
|
|
device.SendHapticImpulse(0, amplitude, duration);
|
|
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
|
|
{
|
|
|
|
device = InputDevices.GetDeviceAtXRNode(Hand);
|
|
|
|
device.StopHaptics();
|
|
|
|
}
|
2022-08-26 22:06:45 +02:00
|
|
|
void Uppdate()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2022-08-12 02:20:00 +02:00
|
|
|
}
|