[VRTK4.0] Using the Unity input system with VRTKv4

learning target:

   展示了如何在Unity项目中设置Unity输入系统,以及如何导入输入系统Tilia包以支持VRTKTilia包与新的Unity输入系统操作一起工作。


process:

step one:

          First we need to check the project settings again if it has the new Unity input system. View through Project Settings->Player:

Step 2:

      Now we need the Tilia package, so we go to the window Tilia package importer. Since we need the new Unity input system, we need to import the corresponding package:

 At this point, we won't get any default actions for the consent input system, but there is a package we can install, for which we go to the package manager and find "Tilia Input UnityInputSystem"

Step three:

      At this point we can see an XR mapping sample, and then click Import:

After the import is completed, we can see that there is a Universal XR folder in our asset directory. When we open it, we will see a collection of Acura prefabs. What we want to use is the input action mapping in the Universal XR prefab. We only You just need to drag it into the scene:

 When we expand it, we can find that underneath it there are a bunch of common operations for the left and right controllers, which just cover the common buttons on most VR controllers:

 Step four:

       We can test these controller buttons with simple examples, again creating a cube and a ball:

 Then we find the trigger press on the right trigger and then expand it and we can see that it has a boolean operation and the boolean operation will represent when it is true and when it is false, in this case when we press When the button is pressed, it will be activated to true, and when the button is released, it will be deactivated, so, we can use them to do something with these things, so when we press the trigger is inactive we will cube To hide, then in the deactivated state, when we release the button, we show the cube:

 In the same way, the same is true for other buttons:

 OK, that’s it for today’s explanation. 

Guess you like

Origin blog.csdn.net/LiKe11807/article/details/130854061