VR SDK Unitypiplay-us.pimaxvr.com/Pimax VR Unity SDK description_V1.1.3.pdf · Baidu Search Unity,...

22
小派科技(上海)有限责任公司 小派 VR 为玩家而生 1/ 21 VR SDK_Unity Development Description Document Version:v_1.1.3

Transcript of VR SDK Unitypiplay-us.pimaxvr.com/Pimax VR Unity SDK description_V1.1.3.pdf · Baidu Search Unity,...

小派科技(上海)有限责任公司 小派 VR为玩家而生

1 / 21

VR SDK_Unity

Development Description Document

Version:v_1.1.3

小派科技(上海)有限责任公司 小派 VR为玩家而生

2 / 21

1. Environment building................................................................. 4

1. Installation of Pitool................................................................. 4

2. Connecting Petit Helmet Equipments......................................... 4

2. Use of Unity ..................................................................................... 5

1. Download UNITY Development Engine.......................................... 5

2. Create UNITY projects...................................................................5

3. import SDK.................................................................................................... 7

1. Download/installSDK.............................................................................7

2. import SDK..........................................................................................8

4. use of SDK ..................................................................................... 10

5. Pack Unity .................................................................................... 12

6. Realization of Helmet Key Function ................................ 15

7. Reset the positive direction ................................................. 18

8. Meaning of each interface script ...................................... 18

1. PVRSESSION.CS ................................................................................ 18

2. PVRPOSETRACKING.CS ........................................................................ 19

3. PVREYEOFFSET.CS ............................................................................. 20

4. PVRSURFACE.CS ................................................................................ 20

5. PVRINPUTEVENT.CS ........................................................................... 20

小派科技(上海)有限责任公司 小派 VR为玩家而生

3 / 21

9. Introduction to sample scenarios ..................................... 21

1. SIMPLEVRDEMO: ................................................................................ 21

2. MULTICAMERADEMO: ............................................................................ 21

3. OBJECTTRACKEDDEMO ........................................................................... 21

4. RECENTERONINPUTDEMO ....................................................................... 21

5. CustomMirrorWindowDemo: ......................................................... 21

小派科技(上海)有限责任公司 小派 VR为玩家而生

4 / 21

1. Environment building

1. Installation of Pitool

Log on official website of pimax, https://pimaxvr.com/ Mouse

to user support panel, pop-up option click download and

install

2. Connecting Petit 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.

小派科技(上海)有限责任公司 小派 VR为玩家而生

5 / 21

2.use of Unity1.Download Unity Development Engine

Baidu Search Unity, Download Unity Engine from Unity

Official Website.

2.Create Unity Project

1. Double-click Unity to open the desktop, create a new

project, and click NEW in the upper right corner to create

the project.

小派科技(上海)有限责任公司 小派 VR为玩家而生

6 / 21

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.

小派科技(上海)有限责任公司 小派 VR为玩家而生

7 / 21

3. When the creation is complete, a Unity operation window

will be entered, which is our Unity project.

3. import SDK1. Download/install SDK

1. Log on official website,https://pimaxvr.com/ Mouse to

the developer board, click SDK。

2.Click to download the corresponding SDK

3. Double-click download exe to install, (language selection)

confirm - > next - > next - > install - > confirm, that will

open the directory of successful SDK installation.

4. The directory of Unity_SDK is installed by

小派科技(上海)有限责任公司 小派 VR为玩家而生

8 / 21

default*\Pimax\Sdk\Unity_plugin

2. 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:

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

小派科技(上海)有限责任公司 小派 VR为玩家而生

9 / 21

folder, click the "Open" button in the lower right

corner.

2. 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.

小派科技(上海)有限责任公司 小派 VR为玩家而生

10 / 21

3. The following directory of resource files shows that we

imported successfully

4. 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:

小派科技(上海)有限责任公司 小派 VR为玩家而生

11 / 21

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.

小派科技(上海)有限责任公司 小派 VR为玩家而生

12 / 21

5. packUnity

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

小派科技(上海)有限责任公司 小派 VR为玩家而生

13 / 21

Step 2: Click File - > Build Setting in the top corner and

an option box appears,

Step 3: Click add OpenSences to add your packaged scenario

小派科技(上海)有限责任公司 小派 VR为玩家而生

14 / 21

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)

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.

小派科技(上海)有限责任公司 小派 VR为玩家而生

15 / 21

6. Realization of HelmetKey FunctionResponse 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:

2. Create a script, right-click Creat - > C Script in the

red space below, create a script, double-click to enter

小派科技(上海)有限责任公司 小派 VR为玩家而生

16 / 21

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

小派科技(上海)有限责任公司 小派 VR为玩家而生

17 / 21

4. In the event.format in the RecenterTest.cs 脚本 in the

Sample directory, the default buttons

小派科技(上海)有限责任公司 小派 VR为玩家而生

18 / 21

7.Reset the positive direction

Calling interface:

PVR.Unity.PVRSession.instance.recenterTrackingOrigin(); The

interface can be invoked in the key response to achieve a

positive reset, as shown below:

8. Meaning of each interface script

1. PVRSession.cs

Realize the connection with PVR runtime, each scenario needs

and only needs to add one, you can use PVRSession. prefab to

add

小派科技(上海)有限责任公司 小派 VR为玩家而生

19 / 21

2. 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:

小派科技(上海)有限责任公司 小派 VR为玩家而生

21 / 21

3. PVREyeOffset.cs

Position the eyes

according to their

position

4. PVRSurface.cs

Implementing the output of camera screen to helmet,

depending on Camera component, PVREyeOffset component。

5. PVRInputEvent.cs

小派科技(上海)有限责任公司 小派 VR为玩家而生

21 / 21

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。

9. Introduction to sample scenarios

1. SimpleVRDemo:

Example VR example of a single PVRCameraRig

2. MultiCameraDemo:

The example uses multiple PVRCameraRigs to implement

more complex requirements, including whether each

PVRCameraRig can be customized with head control.

3. ObjectTrackedDemo: In the example

scenario, an object has head or

handle action control.

4. RecenterOnInputDemo: Example

Handle Button Event Processing

and Resetting Positive Direction.

5. CustomMirrorWindowDemo:

小派科技(上海)有限责任公司 小派 VR为玩家而生

21 / 21

The example shows different windows pictures from those in

the helmet by ordinary camera.