0 votes
by (140 points)

想用摇杆来控制摄像机移动,这个要怎么实现啊,刚刚接触这个,不知道从哪下手

1 Answer

0 votes
by (6.0k points)
edited by

可以先看一下文档Pico硬件通用说明,参考XR Interaction Toolkit的使用教程。
https://developer.pico-interactive.com/docs/cn/12050/225281/#_5-1-pico%E7%A1%AC%E4%BB%B6%E9%80%9A%E7%94%A8%E8%AF%B4%E6%98%8E

还有看看Unity官方提供的相关API:
https://developer.pico-interactive.com/docs/cn/12050/225284/#_9-1-unity%E7%9B%B8%E5%85%B3
下面代码就是获取摇杆移动数值的,后面移动就以这个数据来变化就行

 Vector2 primary2DAxis = Vector2.zero;
    InputDevices.GetDeviceAtXRNode(XRNode.LeftHand).TryGetFeatureValue(CommonUsages.primary2DAxis, out primary2DAxis);
    InputDevices.GetDeviceAtXRNode(XRNode.RightHand).TryGetFeatureValue(CommonUsages.primary2DAxis, out primary2DAxis)

或者看看xr官方的demo也行
https://github.com/Unity-Technologies/XR-Interaction-Toolkit-Examples

...