Wednesday, April 6, 2022

SteamVR Input in MRTK 2.6 and later

 Hello,

I've seen a lot of interest on this topic and I would like to put the info in one place.

First, you need to download SteamVR asset and use my implementation of SteamVR XRSDK Device Manager and controllers from here.

There are two parts: one is in SteamVR and one is in MRTK. 
If you already know the actions you need for SteamVR, then you need to generate the SteamVR_Input action classes (these are used by the custom implementation of the SteamVR layer in MRTK) by going to Unity Editor menu, Windows -> SteamVR Input and hit Generate. If you need to change the bindings, you will need to create the bindings in the bindings UI.




Then, you need to add the SteamVR XRSDK manager to data providers and use the Player prefab from SteamVR - this will give you the avatar hands (ofc, you can create a separate one with whatever hands you want but you will need to animate that).


Then you need to add SteamVRXRSDKControllers in the Controller Definitions area.


 
Then you need to alter input mappings for the Generic OpenVR Controller Definitions (if you plan to add specific actions - in my case I used Touchpad click as Select):



Then you need to Update mappings by going to Unity Editor and in the menu: Mixed Reality Toolkit -> Update -> Controller mappings profiles. This will update some assets from MRTK.

Then you need to activate the SteamVR for MRTK by adding the preprocessor directive STEAMVR_INTEGRATION in Unity Editor/Player/Other.



Finally, you need to activate the OpenVR Loader in XR Management.



If you hit Play in Editor, the app will start and you should see the MRTK default gizmo controllers synced with the SteamVR avatar hands.

That's about it!

Have fun!