[Gvr] Simple Analysis of Google vr sdk for Unity, gvrunity

Source: Internet
Author: User
Tags google vr unity 5

[Gvr] Simple Analysis of Google vr sdk for Unity, gvrunity
Preparations

Google vr sdk for UnityGithub download: https://github.com/googlevr/gvr-unity-sdk

Google vr sdk documentation: Https://developers.google.com/vr/unity/#features

Google APIs for Unity: https://developers.google.com/unity/

Environment:Unity 5.3.1 x64+Gvr 0.8

 

Build Environment

1. If you only need the SDK GoogleVRForUnity. unitypackage, refer to my article: Download a single file from Github. Of course, you can clone the entire project.

2. Create a new project and import gvr

 

Demo Analysis

There are two demos in the sdk, under GoogleVR \ DemoScenes \ HeadsetDemo | ControllerDemo

HeadDemo

This demo is the gvr head movement Demo, on the PCHold down Alt + move the mouseSimulate head rotation, press and holdCtrl + move the mouseSimulate head skew

Both of the above areGvrMain \ HeadThe transform attribute of is changing.

When you select a GameObject, an animation of zooming and downgrading the zooming star is displayed. For the implementation code, seeHeadDemo \ Teleport. cs

 

ControllerDemo

This demo is probably controlled by connecting to the mobile phone. For the implementation code, seeControllerDemo \ ControllerDemoManager. cs

 

 

Q &

Explanation: I directly useGvrMain. prefabThe Main Camera that appears refers:GrvMain \ Head \ Main Camera

 

Why are there no stars in my scenario?

A: SetGoogleVr \ Prefabs \ UI \ GvrReticle. prefabDragGrvMain \ Head \ Main CameraLower

 

Why can't GameObject be selected in my scenario?

Answer: 1. GiveMain CameraAddPhysics Raycaster

2. InPhysics RaycasterOfEvent MaskSelect the Layer to receive events

 

How can I enable a GameObject to be selected?

Answer: 1. Add Collider (BoxCollider, SpereCollider, and so on) to the GameObject)

2. Add the Event Trigger (Event Trigger) to the GameObject)

3. bind an event processing script to the GameObject. The script contains the following functions: Enter, Trigger, and Exit.

 

How can I display my UI elements in 3D scenarios?

Answer: 1. UseUGUIFor example, create a simple UI

2. ModifyRender ModeIsWord SpaceIn this way, it can be rendered in the world space, rather than on the top screen.

3. Adjust the UI locationMain CameraIn-View

 

How do I receive events that are clicked by players by UI buttons in scenarios?

Answer: 1. After creating the UI, findEventSystem

2.EventSystemAddGazeInputModule

3.EventSystemOnStandalone Input ModuleDisable or adjust the order to GazeInputModule, or Remove it.

4. bind an event processing script to the UI Button. The script contains the following functions: Enter, Trigger, and Exit.

 

How to change the two screens to normal display

A: InGrvMainOfGvrViewerComponent, not checkedVR Mode Enable

Appendix

How to Make a VR Game With Unity and Google Cardboard

Https://www.raywenderlich.com/116805/make-vr-game-unity-google-cardboard

Http://www.tairan.com/archives/10636/

Related Article

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.