Unity3d SteamVR Plugin Study notes (1)

Source: Internet
Author: User

    • SteamVR plugin plugin is used.

In the resource store, download the latest STEAMVR plug-in (https://kharma.unity3d.com/en/#!/content/32647) Import project.

    • Errors may occur:
Question 1

Failed to load Ivrrendermodels interface version ivrrendermodels_005

Current Workarounds

This issue is discussed in the Steam Official forum, please take a closer look. https://steamcommunity.com/app/358720/discussions/0/357286663674402763/

    • SteamVR Plugin Script Analysis
    • Assets/plugins/openvr_api.cs

This directly encapsulates the support of the STEAMVR SDK.
is a required script. It provides all the features STEAMVR exposed. Do not advise you to do
Change this file. Should be synchronized with the associated OPENVR_API DLL.

    • Assets/steamvr/scripts/steamvr.cs

initialization and shutdown of the system. access using Steamvr.instance . for any reason, NULL may be returned if the initialization fails.

    • Assets/steamvr/scripts/steamvr_camera.cs VR camera, the main function is to change the picture of unity camera to form the imaging image in Vive.

To combat the stretching caused by distortion correction, render the scene at a higher resolution. because all cameras in unity are rendered sequentially, a static rendering texture is shared between each eye camera .

STEAMVR provides a specific render target size to mitigate distortion, However, rendering to a higher resolution in the relevant costs under provides additional multi-sampling benefits . This can be controlled by Steamvr_camera.sceneresolutionscale.

Note: Guilayer and Flarelayer are incompatible with Steamvr_camera because they are in screen space rather than in world space. Rendering .

these will automatically move the Steamvr_gameview object, and the object itself will automatically the parent ' head ' object added to the Steamvr_camera. The Audiolistener is also shifted to the head so that the audio is properly spatially formatted.

    • Assets/steamvr/scripts/steamvr_overlay.cs-This component is used to assist in rendering 2D content in VR.

uses a special render path to synthesize the specified texture into a scene on a virtual surface to improve Fidelity.

    • Assets/steamvr/scripts/steamvr_trackedobject.cs-Add it to any object that you want to use the trace.

the The HMD has a set to automatic. for the controller, select the index of the object you want to map to. in General, you should load these objects into the camera's "origin" object so that they are tracked in the same space. However, if it is inconvenient, you can specify "origin" in the Trackedobject itself.

    • ASSETS/STEAMVR/script/Steamvr_rendermodel.cs-This component is used to render the model of the handle, and the position of the tracking handle .
    • Assets/steamvr/scripts/steamvr_utils.cs-A variety of bits used in unity to use the SteamVR API, including a Simple Event System for dealing with vector/four-pair rigidtransform classes, matrix transformations and other useful features.
    • Steamvr_playarea

      Used to display player playable areas. Using the method, add the script on the Origin object to

    • Steamvr_controllermanager and Steamvr_trackedobject

Controller, primarily used to set up and detect VIVE controllers.

Vive controller consists of menu key (Applicationmenu), Touchpad (Touchpad), System Key/Power key (systems), trigger key (Trigger), Side handle key (Grip), composed

How to use:

Add 2 sub-objects to the Origin object to represent the 2 handles of Vive, and increase the Steamvr_trackedobject,index setting to None

Add Steamvr_controllermanager on Origin object, set left and right handles

Add a sub-object master camera as head on Origin, plus steam vr_tracked object

    • Information about the Steamvr_controller controller

Information about the controller is included in the Steamvr_controller script. Note: Steamvr_controller is a non-monobehavior script that is not hanging in the scene and is running through the Steamvr_render script for a call to the update () function, which loops through the handles to get information about the handle.

The Steamvr_render script is automatically loaded into the scene when the program runs.

Buttonmask class: The name of each key of the handle.

Device class: The most important class that encapsulates all the information for a tracking device.

Update () function: Called by the Steamvr_render script, updates the information for each tracking device.

The Input () function: Initializes a device[] array based on index and instantiates all 16 device.

Detailed Steamvr_controller class content can refer to the blog: Unity SteamVR plugin detailed one: Steamvr_controller script Analysis +vive controller function development.

Unity3d SteamVR Plugin Study notes (1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.