获取完整课程以及答疑,工程文件下载:
https://www.spatialxr.tech/
Unity XR Interaction Toolkit 系统化开发教程:https://www.spatialxr.tech/course/5
视频试看链接:7.手柄追踪【Unity XR Interaction Toolkit 跨平台开发教程】(3.0以上版本)
系列教程专栏:Unity XR Interaction Toolkit 系列教程(SDK 版本 3.0 以上)
在玩家物体 XR Origin 身上新建两个空物体,用于表示左手柄和右手柄:

在这两个物体身上分别添加 Tracked Pose Driver (Input System) 脚本,然后进行参数赋值。
左:

右:

需要引用 Input System 输入配置文件中定义的对应动作。然后这个脚本就能够追踪现实中手柄的位置和旋转,把追踪到的数据映射到虚拟世界中的 Left/RightHand Controller 物体上,与现实中的手柄产生同步。
然后可以把手柄模型作为这两个物体的子物体:

官方提供的手柄模型位于下图的路径中:

现在就可以追踪手柄,并且在场景中渲染出手柄模型了。