mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-11-30 21:47:16 +01:00
22 lines
566 B
C#
22 lines
566 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.XR;
|
|
public class Controllers : MonoBehaviour
|
|
{
|
|
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();
|
|
}
|
|
}
|