1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2025-02-15 10:22:33 +01:00
MaiDXR/Assets/Scripts/Controller.cs
2022-03-09 20:52:38 +01:00

23 lines
618 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class Controller : MonoBehaviour
{
// Start is called before the first frame update
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();
}
}