-
1 :获取手柄编号
// 手柄组件 Left = GetComponent<SteamVR_TrackedObject>();
// 获取手柄编号(左手柄 == 2) Debug.Log((int)Left.index);![](https://i-blog.csdnimg.cn/blog_migrate/b3d759787a147ee2bf58031f5188ef51.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b3d759787a147ee2bf58031f5188ef51.png)
在手柄上挂载此脚本
2 : 获取扳机按键
// 按下了扳机按钮调用
if (device.GetTouch(SteamVR_Controller.ButtonMask.Trigger))
{
Debug.Log("trigger"); } 第二种方式也是Ok的 if (device.GetPressDown(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger)) { print("123"); }
2 : 获取扳机按键