获取手柄有两种方法,一种是XR的方法,一种是PicoSDK中的方法。
第一种,XR方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class PicoVRCS : MonoBehaviour
{
List<InputDevice> foundControllers = new List<InputDevice>();
// Start is called before the first frame update
void Start()
{
InputDeviceCharacteristics leftTrackedControllerFilter = InputDeviceCharacteristics.Controller | InputDeviceCharacteristics.TrackedDevice | InputDeviceCharacteristics.Left;
InputDevices.GetDevicesWithCharacteristics(leftTrackedControllerFilter, foundControllers);
}
void Update()
{
foundControllers[0].TryGetFeatureValue(CommonUsages.primaryButton, out bool isPress);
if (isPress)
{
}
}
}
第二种是PicoSDK中的方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine

博客介绍了获取手柄的两种方法,分别是XR方法和PicoSDK中的方法,为相关开发提供了技术参考。
最低0.47元/天 解锁文章
3037

被折叠的 条评论
为什么被折叠?



