本博文是自己开发VR项目从网上搜罗的一些关于代码的介绍教程,整理一波,方便以后使用。
SteamVR_Controller类:
关于控制器的相关信息都包含在SteamVR_Controller这个脚本之中。注意:SteamVR_Controller是非Monobehavior的脚本,并没有挂在场景下,其运行是通过SteamVR_Render脚本对于其中Update()函数的调用从而一直循环获取手柄相关信息。而SteamVR_Render脚本是在程序运行时自动加载至场景的。
ButtonMask类:手柄各按键的名称。
- //以下是API中复制出来的按键列表
- /* public class ButtonMask
- {
- public const ulong System = (1ul << (int)EVRButtonId.k_EButton_System); // reserved
- public const ulong ApplicationMenu = (1ul << (int)EVRButtonId.k_EButton_ApplicationMenu);
- public const ulong Grip = (1ul << (int)EVRButtonId.k_EButton_Grip);
- public const ulong Axis0 = (1ul << (int)EVRButtonId.k_EButton_Axis0);
- public const ulong Axis1 = (1ul << (int)EVRButtonId.k_EButton_Axis1);
- public const ulong Axis2 = (1ul << (int)EVRButtonId.k_EButton_Axis2);
- public const ulong Axis3 = (1ul << (int)EVRButtonId.k_EButton_Axis3);
- public const ulong Axis4 = (1ul << (int)EVRButtonId.k_EButton_Axis4);
- public const ulong Touchpad = (1ul << (int)EVRButtonId.k_EButton_SteamVR_Touchpad);
- public const ulong Trigger = (1ul << (int)EVRButtonId.k_EButton_SteamVR_Trigger);
- }
- */