InputDevice leftHandController;
InputDevice rightHandController;
void Start()
{
leftHandController = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
rightHandController = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
GetAll();
}
public List<InputDevice> GetAll()
{
List<InputDevice> deviceList = new List<InputDevice>();
//实际为传入list引用获取的InputDevice全部放在list中
InputDevices.GetDevices(deviceList);
return deviceList;
}
//扳机键
public void DownTrigger()
{
bool isDown; //记录是否按下
if (rightHandController.TryGetFeatureValue(CommonUsages.triggerButton, out isDown) && isDown)
{
Debug.Log("Trigger");
//xxxxx 处理逻辑
}
}文章来源地址https://www.toymoban.com/news/detail-500600.html
//A键
public void DownA()
{
bool isDown; //记录是否按下
if (rightHandController.TryGetFeatureValue(CommonUsages.primaryButton, out isDown) && isDown)
{
Debug.Log(3);文章来源:https://www.toymoban.com/news/detail-500600.html
//xxxxx 处理逻辑
}
}
到了这里,关于pico 4 手柄按键获取的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!