banner
YZ

周周的Wiki

种一棵树最好的时间是十年前,其次是现在。
zhihu
github
csdn

Setting up the unity+steamVR+VRTK development environment


@[TOC](Table of Contents)

Setting Up a VR Development Environment with Unity#


Choose unity2018.3.6f1+steamVR1.2.3+VRTK3.3 for better compatibility.

Tested: Before starting formal development, it's best to install the virtual reality environment drivers and select the appropriate plugin versions to avoid many pitfalls and errors.

HTC VIVE Environment Configuration#

Virtual reality applications require the configuration of virtual reality hardware drivers. The hardware device for this project is HTC VIVE, so you need to download the driver from this website and follow the prompts to install and configure the hardware: https://www.vive.com/cn/setup/vive/.

Steam VR Environment Configuration#

The Steam VR environment is a common environment for most VR software, and this project also requires support from Steam VR. You can browse related information about Steam VR and download Steam at this website: https://store.steampowered.com/steamvr/.
Click the green Install Steam button at the top right of the webpage to download the Steam installer and install it. After installing Steam, you need to manually install Steam VR.

Create Function Import Plugin Check Environment#

Find a plugin with good compatibility; I am using steamVR1.2.3+VRTK3.3. I will upload these two plugins at the end of the article. Import them into Assets, and in the popped-up SteamVR window, click the Accept All button to set up the Steam VR environment without any other error messages indicating it is usable:
Insert image description here

Create VR Interaction Environment#

This project uses VRTK in conjunction with SteamVR to quickly configure the VR environment. Open the VRTK->Prefabs folder in the Plugins folder, find the SDKSetupSwitcher prefab, and drag it into the Hierarchy window:
Insert image description here

In the Hierarchy, create an empty object called Create Empty, name it VRTK_SDKManager, and set its position and rotation parameters to zero. Drag the SDKSetupSwitcher under this empty object to make it a child object. Similarly, create an empty object called VRTK_Scripts and create LeftController and RightController empty objects as its child objects, also setting their position and rotation parameters to zero:
Insert image description here
Next, you need to add the VRTK_Controller Events component to the two empty objects to implement VRTK listening for controller events. Here, LeftController and RightController actually represent the left and right hands in the virtual environment. Therefore, related scripts and objects on the controllers (like UI) can be placed on these two empty objects.
Next, we will add the prefabricated components from VRTK to the empty objects. Select VRTK_SDKManager, click the Add Component button in the Inspector panel on the right, search for VRTK_SDK Manager in the popped-up menu, and click to add this component:
Insert image description here
VRTK supports multiple VR device SDKs, and in this project, we only install the SteamVR SDK. Therefore, we need to create an SDKSetup (SDK configuration) based on SteamVR, referencing it according to VRTK's standards, so that VRTK can uniformly obtain the corresponding input and output configurations.
Create an empty object under VRTK_SDKManager, name it SteamVR, and change its Y-axis position to 0.5. Add the VRTK_SDKSetup component to the empty object, and select the SteamVR option in the Quick Select section of the component:
Insert image description here
In the Project window, go to the Plugins/SteamVR/Prefabs directory, and drag the Camera and SteamVR prefabs under the newly created SteamVR empty object. At this point, check the SteamVR properties panel, and the red warning should disappear:
Insert image description here
At this point, the SDK configuration is complete. VRTK can provide a simulator for a VR environment, which can be viewed from the Plugins/VRTK/Prefabs directory. Create a new SDK configuration named Simulator, drag the VRSimulatorCameraRig prefab from the directory under this empty object as its child object, and set the SDK Setup to Simulator.
Next, configure the SDKManager and enable it. Select VRTK_SDKManager, and in the VRTK_SDK Manager component's Setups option, click the Auto Populate button to enable the SDKManager configuration and automatically sort it. At the same time, drag the left and right hand objects from VRTK_Scripts to the corresponding positions in the Script Aliases section.
Insert image description here
Finally, create a folder named Prefabs in the Project window, and drag the SDKManager and left and right hand objects into this folder to create prefabs for later use.
Insert image description here

Testing the VR Environment#

Test the created VR interaction environment. If the development environment is not connected to a VR device, it will automatically select the VRTK simulator to enter testing. We can perform operations such as moving, rotating, and changing the controller position in the simulator based on the UI prompts in the upper left corner. During runtime, you can click the Switch SDK Setup button in the upper right corner to change the VR environment. If there are no other error messages in the Console window, it runs successfully.
Insert image description here
The error shown in the image can be ignored, mainly because the VR device is not connected; once connected, it will naturally disappear. During runtime, the built-in simulator Simulator from VRTK is used, which is convenient for later interaction testing.

Download steamVR1.2.3+VRTK3.3:
https://download.csdn.net/download/qq_42437783/16608509[Click this link to download the related plugins](https://download.csdn.net/download/qq_42437783/16608509)

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.