1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-12-18 20:05:52 +01:00
MaiDXR/Assets/Scripts/IOs/ControllerHapticManager.cs

22 lines
578 B
C#
Raw Normal View History

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;
public float duration;
public float amplitude;
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();
}
}