Tuesday, March 8, 2016

Unity DIY your own virtual reality world Part two

Unity:DIY your own virtual reality world! (Part two)

Editor's Note: this article is the 2015 year tips Top 10, come up in the posture of an article, is divided into two parts, this is next.

In the previous article of the Unity:DIY your own virtual reality world! , We explain how to use the software to build your own virtual world unity, so in this article we will teach you how to combine unity and Google Cardboard.

If you are a badass with a Smartphone, then Google Cardboard you upgrade that virtual reality users preferred a higher force.

Mainstream virtual glasses company is preparing to be rolled out to the masses. The New York Times recently sent to its subscribers to more than 1 million Google Cardboard, this virtual reality have more audiences. Big companies like View-Master, he started as Google Cardboard children's audience.

Believe in the near future, people will start looking forward to the new virtual reality experience. Next the basics, to let the people in Unity to build virtual reality.

In this article, we'll talk about how to use Unity combined with glass to view virtual reality scenes. I will be the robot scene as an example of the General Assembly (of course you can choose any you like a scenes). In order to show a more straightforward, I only choose the same scene.

Import Google Cardboard SDK

To combine Google feature and Unity of Cardboard, you need to download glasses SDK. Main GitHub page for the SDK provides SDK documentation and an example show. Download is complete you can open our virtual reality journey ~

Open the you want in virtual reality scenes, do the following:

Assets > Import Package > Custom Package.... 

Then find the SDK you just downloaded file:

CardboardSDKForUnity.unitypackage

Unity:DIY your own virtual reality world! (Part two)

Then there will be a "Importing package" window allows you to import the necessary packages. Only need to move is "Legacy" folders, unless you already have older than Unity 5 version of Unity. If you want to check the deleted. VR box 3D headset

Unity:DIY your own virtual reality world! (Part two)

Finished click "Import", the window just closes. Virtual glasses then you need to create a new folder as the site of this project. Everything Google Cardboard SDK is now ready to use.

Unity:DIY your own virtual reality world! (Part two)

You will then see in your newly created Google there are five folders in Cardboard folders: Distortion, Editor, Prefabs, Resources, and Scripts. Here we'll just use the Prefabs in the file.

Set Google Cardboard camera

Best VR box

All things in the Unity through Google Cardboard camera to capture. In the simplest projects, lens called "Main Camera". We wanted to rename, then use Google Cardboard lens instead.

Which requires that imported a new lenses into your scene, do the following:

Open the Prefabs just mentioned folder, you will see a place called "CardboardMain" preset, using the mouse to drag this into your project within the hierarchy.

Unity:DIY your own virtual reality world! (Part two)

Probably looks like:

Unity:DIY your own virtual reality world! (Part two)

If the Unity project is that you have used many times, and you want to continue on the same template, you should take care in the "Main Camera". "CardboardMain" moved to the "Main Camera". When I was doing my own projects, I will move it to {x:0, y:1, z:-10}. When you CardboardMain in the right place, delete the words "Main Camera", or hide it by clicking the check box next to the name.

Unity:DIY your own virtual reality world! (Part two)

Simple testing method is to run the Unity, and then see what the scene looks like.

Testing the Unity virtual reality experience

Unity:DIY your own virtual reality world! (Part two)

In order to test Google Cardboard lens. We need a method referred to as just the first step to run our scenario. Clicking Play, you can view your Google Cardboard scenes. It appears in the Game tab.

Of course, when you're testing in unity, and you can't shake head, otherwise you will feel dizzy. Instead, you can use the keyboard to control the movement of the camera.

Hold down the Alt key and move your mouse to view the scene.

Hold down the Shift key, and move your mouse, you can tilt the angle.

Adjust the VR lens

I positioned well in the previous post example of lenses and virtual reality scenes here are not the same. You will find this is depends on the positioning of your camera. In Unity, we can move around the scene.

In order to move, when the scene position, CardboardMain and adjust the transform value found in the hierarchy. For example, I changed in my test scenario CardboardMain z position. Scenario runs when any change is temporary.

Unity:DIY your own virtual reality world! (Part two)

When the orientation of the lens to achieve satisfactory results, and note CardboardMain position value, and then click Play again to stop the test. Re-enter these values and make CardboardMain permanent.

Use Google Cardboard

In order to test Google Cardboard, you need to install the iOS or Android Unity. But note that SDK only works with version iOS8 of iPhone5 virtual glasses.

Build iOS app, you need to have an Apple account to mastering XCode software to use it. It's a bit outside the scope of this article ... ...

Building Android applications by comparison somewhat simpler, you just need to install the Android SDK,

Start building programs, build settings do the following:

File > Build Settings:

Unity:DIY your own virtual reality world! (Part two)

In the settings, first select your Smartphone OS (Android or iOS). then click on "Player Settings" setting for further details. In these options, you can click the "Other Settings" to expand the more options item. Here, there is a field called "Bundle Identifier identifier". This is the standard application form.

com.company.appname. 

Change options for you, for example, I set up my

com.makermedia.cardboarddemo.

Unity:DIY your own virtual reality world! (Part two)

And then expand "Resolution and Presentation" section, set the default direction to "Landscape Left."

Unity:DIY your own virtual reality world! (Part two)

Finally, connect your device and your computer (my Android device is connected), then click "Build and Run" to create an application, and then let it run automatically on your device.

 

Unity:DIY your own virtual reality world! (Part two)

This article contains a simple virtual reality experience Google Cardboard method. In this series, and we know how to implement Google Cardboard glasses and real interaction.

via makezine

What is very cool, feeling a little worship ourselves. So what are you waiting, get attention-

  Best VR box

No comments:

Post a Comment