# Unity PC XR SDK


# Environment building

# Installation of Pitool

Find PiTool download link from here or Pimax official website (opens new window).

# Connecting Pimax Helmet Equipments

Connect the power adapter data line, DP and USB cable to the computer, turn on Pitool and wait for the device to connect to the computer. When the helmet shows the green light, the connection is successful. PiTool

# Use of Unity

# Download Unity Development Engine

Google Search Unity, Download Unity Engine from Unity Official Website.

# Create Unity projects

  1. Double-click Unity to open the desktop, create a new project, and click NEW in the upper right corner to create the project. Unreal

  2. After clicking, an option window appears. The first line of project name is the project name, and the second line of location is the path to store the project. After entering the completed project name and path, click Create Project to create a Unity project. Unreal

  3. When the creation is complete, a Unity operation window will be entered, which is our Unity project. Unreal

# Import SDK

# Download/Install SDK

Download Pimax Unreal sdk from here and install the sdk. The Unity_SDK is installed to \Pimax\Sdk\Unity_plugin by default.

# Import SDK

  1. Find the Unity_plugin folder and import the PVR-Unity.unitypackage resource package into the scenario. There are two ways to import the PVR-Unity.unitypackage resource package into the scenario:

Method 1 : Drag and drop the PVR-Unity.unitypackage resource package onto the Assets folder as shown in the figure below: Unreal

Method 2 : Find the ASSETS file directory in the figure. Mouse over to Assets and right-click Custom Package in Import Package. Find the folder that holds the PVR-Unity.Unitypackage resource package in the selection box that appears. After clicking the PVR-Unity.Unitypackage in the folder, click the "Open" button in the lower right corner. Unreal

  1. To complete one of the above two operations, a bullet window will appear as shown in the figure. Click the Import button in the lower right corner to import the SDk. Unreal

  2. The following directory of resource files shows that we imported successfully. Unreal

# Use of SDK

  1. Find the PVRUnity folder in the Asset directory, drag the PVRCameraRig and PVRSSession prefabricates in the Prefab folder into the Sence view, and delete the MainCamera of the original scene, as shown in the figure: Unreal

  2. To ensure that the helmet in Pitool is connected successfully, we can start our VR development journey by clicking the left triangle button of the red circle in the picture to run the project. Unreal

# Pack Unity

How to package VRDisplayDemo into. EXE file?

Step 1: Click Save Sence in the File column in the upper left corner to save the scene Unreal

Step 2: Click File - > Build Setting in the top corner and an option box appears, Unreal

Step 3: Click add OpenSences to add your packaged scenario VRDisplayDemo, Choose the published platform as the first one in the option bar(PC-side options in red boxes), Select the Architecture as x86_64 (click on the x86 bar button to display a drop-down menu, and select X86_64) Unreal

Step 4: After the above two steps are completed, click the Build button in the lower right corner (as shown below), and a window will appear to select the path to store. exe. After selecting the path you want to store, click Save. In this way, a Unity version of the VR project has been successfully completed.

# Realization of Helmet Key Function

# Response to keystroke events

  1. Find the PVRInputEvent. CS script in the SRC folder of the PVRUnity under the Asset directory, right-click in the blank of the Hierarchy panel to create Creat Empty, click the GameObject, and drag the script to the location shown in the figure: Unreal

  2. Create a script, right-click Creat - > C Script in the red space below, create a script, double-click to enter: Unreal

  3. The script inherits the PVR.Unity.IPVRInputEventTarget and adds the following code in the script, and changes the output print log to the relevant logic code to realize the press-up event response of the key: Unreal

4 .In the event.format of the RecenterTest.cs script in the Sample directory, the default buttons: Unreal

# Reset the positive direction

Calling interface:


The interface can be invoked in the key response to achieve a positive reset, as shown below: Unreal

# Meaning of each interface script

# PVRSession.cs

Realize the connection with PVR runtime, each scenario needs and only needs to add one, you can use PVRSession. prefab to add Unreal

# PVRPoseTracking.cs

Realize the binding of GameObject's pose (direction and position) to head, handle, etc. When the PVRCamereRig sub-object is checked out, the script in PVRCamera can turn off the gyroscope on the VR headgear, as shown in the figure: Unreal

# PVREyeOffset.cs

Position the eyes according to their position

# PVRSurface.cs

Implementing the output of camera screen to helmet, depending on Camera component, PVREyeOffset component.

# PVRInputEvent.cs

Achieve the sending of key events on the handle, and use the format in RecenterTest. CS script to receive events, complete the response of keys, and control keys。

# Introduction to sample scenarios

# SimpleVRDemo

Example VR example of a single PVRCameraRig

# MultiCameraDemo

The example uses multiple PVRCameraRigs to implement more complex requirements, including whether each PVRCameraRig can be customized with head control.

# MultiCameraDemo

In the example scenario, an object has head or handle action control.

# RecenterOnInputDemo

Example Handle Button Event Processing and Resetting Positive Direction.

# CustomMirrorWindowDemo

The example shows different windows pictures from those in the helmet by ordinary camera.