1
0
mirror of synced 2024-12-20 10:15:54 +01:00
WACVR/Assets/Script/Controller/Controller.cs

22 lines
565 B
C#
Raw Normal View History

2022-05-16 23:38:40 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class Controller : 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();
}
}