Preliminary study on virtual reality development of cardboard (II.)

Source: Internet
Author: User

Google Cardboard Virtual reality Glasses Development Preliminary (ii) Cardboard SDK for unity use

The previous article as the beginning of the series, mainly about some of the virtual reality of the technology and principles, this article will lead you to see Google's cardboard SDK for Unity, although the current data and documentation is less, but this package is still very convenient to use, As long as you have a little touch with unity, you can easily use it, and I'll explain it in a way that's a beginner to unity.

In order to facilitate everyone to read, I will take the steps as far as possible to write more detailed, the relevant Google official online English materials and my own translation of the Chinese reference I will also be published in the form of blog, convenient for Google students to read and download.

(a) download cardboard SDK for Unity on official website

Google Cardboard Official website:
https://www.google.com/get/cardboard/

Go to the Developer Guide page of the Google Cardboard official website and click on the download and Samples under the unity SDK on the left:
Https://developers.google.com/cardboard/unity/download

Click Download Cardboard SDK for Unity, direct link to zip, to download;
A classmate who is not on Google can also download it in the file I upload:

http://download.csdn.net/detail/sunmc1204953974/8888421

But it is best to go to the official website to download the latest package, because this just haunt how long, the replacement is very fast.

(ii) Import Cardboardsdkforunity.unitypackage

Note here that if the SDK package was previously downloaded, There is only one cardboardsdkforunity.unitypackage, and after the import contains the support code and an example, and the new SDK package downloaded from the official website contains cardboardsdkforunity.unitypackage and Cardboardsdkforu Nity.unitypackage two packages, the first one is the library, the second is the demo, all imported to run the instance.

First open unity,new a new project.
(I am using the latest unity5,unity5 compared to the previous version has a large change, the current data is relatively small, but now also has a lot of people use.) )

After that, you'll be through the Custom package, assets, Import ...
Introduce the downloaded SDK package. (as the Scarlet Letter said, the newly downloaded SDK package needs to be introduced two times)

(iii) Operation Demoscene

After we've seen the. unitypackage file imported, there is an extra cardboard folder under the Resources folder in the Project panel, which is the SDK plug-in Code and demo sample to see the demoscene folder under the Cardboard folder. This is one of the examples (there is another example under the Legacy folder, which I'll talk about in the next article when I do the code comment), double-click the scene file demoscene to open the example.

Click the Run button above (the small arrow) to see how the Demo sample works.

After running, press ALT to move the mouse to simulate the head rotation, hold CTRL to simulate the tilt of the neck when the angle of view changes, click the mouse equivalent to trigger, can be used to operate.

This demo has a few features in general:

    • Focus on the small yellow dots on the block, click the mouse, the block will be driven to a distance limited by the random position on the sphere

    • When looking at a block, the block will turn from red to green, and the block will change from green to red when looking away from the block.

    • At the foot there are three buttons, respectively

      • Reset: Reset the block back to its original position
      • Recenter: Back to the center of the left and right direction
      • VR mode: Turn VR on or off (split screen or not)

We see that this demo code has only one file, and it is very short, just a few lines of script to achieve this effect (split screen, gyroscope, perspective rotation ...) , I have to say that the Cardboard SDK is still very powerful, and I will write an article specifically analyzing the demo and the code to help you quickly understand the use of the Cardboard SDK.

In the process of reading the Code and development, you can refer to the official website of the document, I will also send an English document and a copy of my own reading when the way to translate the document, help inconvenient on Google's classmates.

After setting the ANDROIDSDK path, packaged and exported to Android project, installed on the phone, you can put in the cardboard or storm mirror and other finished mirror to feel the ~ if the phone screen resolution is high, the feeling is very good.

Set ANDROIDSDK:

Here is not the detail of the online a lot of tutorials.

Export Android APK:

Note here that you need to click on the following player Settings, then there will be some settings on the right, you must reset the package name, or use the default package name, is not packaged. You can also set the app's icon, name, and so on in this

Effects after installation to the phone:

My cell phone pixel is relatively low, but put in the storm magic mirror feeling is still good. Next time I will teach you how to create a scene of your own, put your own model into the scene, with virtual reality glasses to watch the operation. Later on I will dissect the demo's Code and official documentation, enumerate the methods that are often called in virtual reality development, and how to do further development. Please look forward to ~

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Preliminary study on virtual reality development of cardboard (II.)

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.