Virtual Reality — Input and Hand presence

Window → Analysis → XR Interaction Debugger → Input Device

Above window shows the input devices.

How to use these inputs in custom component?

  1. Add component → New Script names HandPresence.cs
  2. Add using UnityEngine.XR;
  3. To get list of devices,
void Start(){
List<InputDevice> devices = new List<InputDevice>();
InputDevices.GetDevices(devices);
foreach(var item in devices){
Debug.log(item.name + item.characteristics);
}
}

5. To get only the right controller instead of entire list,

void Start(){
List<InputDevice> devices = new List<InputDevice>();
InputDeviceCharacteristics rightControllerCharacteristics =
InputDeviceCharacteristics.right |
InputDeviceCharacteristics.Controller;
InputDevices.GetDevicesWithCharacteristics(
rightControllerCharacteristics, devices);
foreach(var item in devices){
Debug.log(item.name + item.characteristics);
}
}

Consultant