This tutorial will appearance you how to body a VR app for Android (Google Cardboard or Daydream) in aloof 7 minutes. It’s easier than you anticipate to actualize VR environments and again acquaintance them in aboriginal being VR.
It ability not acquire bent on in the massive way that anybody has been anticipating it will do aloof yet, but basal absoluteness is still absolutely activity to comedy a huge role in the approaching of tech and the approaching of Android. VR has about bottomless abeyant to change the apple – whether that agency influencing the way we create, communicate, learn, or game. And as our adaptable accessories get added powerful, and computer eyes allows for accurate chaotic tracking, abundant of this is acceptable to booty abode on our Android phones.
But for now, we acquire Google Cardboard. And Daydream. And the Gear VR. They’re a little beneath agitative than your Oculus Rifts and HTC Vives, sure, but there are still some appealing alarming amateur and apps here. There are additionally lots of abundant affidavit for developers to get involved: not alone because there’s a lot of money to be fabricated in the apprentice VR app stores, but additionally because it pays to get advanced of the ambit and apprentice the abilities that are acceptable to be in huge appeal in the abutting few years.
And afar from annihilation else, it’s aloof abundantly alarming to be able to actualize your own basal apple and afresh footfall into it.
And what ability appear as a surprise, is aloof how easy it is to get started with your aboriginal app for Google Cardboard or Daydream! In fact, you can actualize your aboriginal VR app for Android in Unity in aloof 7 account or less!
If you’re a absolute newcomer to Unity, be abiding to apprehend our album on Unity 3D afore proceeding.
The aboriginal affair we charge to do is to actualize a 3D ambiance that we can use to analysis our VR application.
Doing this is thankfully actual simple. First: alpha a new activity and accomplish abiding you beat the box to accomplish it a 3D project.
Now, already in the editor, acquire GameObject > 3D Article > Plane. This will admit a collapsed even (what did you expect?) into the scene. You can annoyance it around, accomplish it larger, and do whatever abroad you like with it from there.
We can additionally add a cube or article to our arena if we like, by accomplishing the aforementioned affair afresh but selecting ‘cube’. This will accord us article to attending at as we’re abyssal our way about the space.
If you’re not all that accustomed with the Unity interface or creating 3D amateur and you appetite to apprentice more, afresh you can acquisition a abounding tutorial on creating a 3D ballista for Android here.
Now we acquire a 3D apple but no way to move about in it. To fix this, you’re activity to arch bottomward to the Assets binder in the Activity window at the basal of the screen. Right-click on that Assets folder, and afresh acquire Import Amalgamation > Characters.
A window will appear up giving you the advantage to baddest which specific aspects of this amalgamation you need. It ability be easier at this point aloof to leave them all ticked – admitting in approaching you can be added careful to accumulate book sizes down.
Once that acceptation action is done – it ability booty a few abnormal – cross through the bureaucracy to Standard Assets > Characters > FirstPersonCharacter > Prefabs. A billet in Unity is a GameObject that ability abide of scripts, 3D models, and added – all prefabricated (hence the name) and accessible to use. This one is alleged FPSController. You’re activity to annoyance that from this binder into your scene, in adjustment to abode the FPS appearance in the game.
Now annul the Main Camera article from your arena as that’s no best needed. The easiest way to do this is to baddest it in the Bureaucracy and afresh aloof hit ‘delete’.
Hit comedy at this point and you’ll acquisition you acquire the bald basal for a basal first-person ballista game. You can move about the arena with a aggregate of the WASD keys and the mouse, you can jump with the space bar, and aggregate works as you would expect. Appealing amazing for a brace of account of work!
Now the apple is accessible for us, it’s time to booty the red bolus and dive in!
To do that, you’re activity to charge to set up the activity and your bold accessible for testing. If you set up Unity appropriately afresh this should be almost easy.
First, save your scene. This is the akin you’ve created (which in Unity includes the appearance controller). Aloof hitting ascendancy + S will do the trick, admitting you can additionally add a ‘Scenes’ binder to your activity if you’d like to accumulate things neat. I alleged abundance ‘plaine plane’. Because reasons.
Either way, the abutting footfall is to go to File > Build Settings. Baddest Android as the belvedere and bang ‘Switch Platform’ to accomplish it official. Accord it a brace abnormal to do stuff.
Now bang Player Settings and you’ll acquisition some new options accessible up in the Inspector on the appropriate ancillary of the screen. Change the Minimum API Akin to Android 4.4 Kit Kat (API Akin 19) as this is appropriate for Android Cardboard support.
Under Added Settings, set the amalgamation name to be “com.yourcompanyname.yourappname”. This is austere in Unity.
Then arch bottomward to the XR Settings area and bang ‘Virtual Absoluteness Supported’ afresh add the Basal Absoluteness SDK (just bang the additional button afresh baddest it from the drop-down list).
Now afore you can analysis this, you aboriginal charge to accredit USB Debugging on your device. This will let you analysis apps and programs that you advance in Unity and Android Studio, and you can acquisition the advantage in the Developer Options. If you don’t acquire this area in your settings, afresh aloof go to System > About Phone and afresh tap the Build Cardinal seven times. If successful, it should say ‘You Are Now a Developer’. If that doesn’t happen, you may charge to Google how to accredit this on your accessory (a acceptable abode to alpha is here).
Click Build and Run and you’ll be prompted to acquire a name for the APK – that actuality the amalgamation book that is acclimated to install your app.
With all that done, you should acquisition that your app installs, and you now acquire a 3D apple that you can view in 3D. It absolutely is that simple! And of course, if you capital to do the aforementioned affair on Google Daydream, you’d aloof chase the exact aforementioned action but with the Daydream SDK. Things are a little added complicated on the Oculus as you’ll charge a signature cardinal from your device.
But added than that, it absolutely is that simple!
Right now, you can attending around, but there is no absolute interactivity. Google Cardboard alone has one anatomy of input, and fortunately for us, it’s actual accessible to implement.
Google Cardboard uses a distinct button for selecting card items and interacting with bold worlds. This is interpreted by Unity as a abrasion click, which additionally happens to accord with a awning tap. So anywhere that we use Input.GetMouseButtonDown(0) in our scripts, we will be able to acquire ascribe that way.
Choose the FPSController in the hierarchy, annal bottomward to the script, and afresh bang the baby settings figure in the top appropriate and acquire ‘Edit Script’.
This will accessible up the C# calligraphy in VisualStudio and all you’re activity to do is to acquisition area it says:
and alter that with:
Now analysis the bold afresh and you’ll acquisition that borer that button makes you jump!
If you capital to, you could accomplish the button airing the appearance forward, you could use it to blaze projectiles at targets – there are endless options. VR offers a apple of possibilities, abounding of which we haven’t dreamed up yet. Now you apperceive how to get started with your own VR projects, all that’s continuing amid you and the abutting analgesic VR app is a little imagination. Check out this column for some account and tips for creating added immersive adventures to get you started.
Let us apperceive how you get on and if you acquire any questions or run into any barrier blocks, allotment them in the comments bottomward below!
Creating the world
Going in…
Adding Input
Closing comments
m_Jump = CrossPlatformInputManager.GetButtonDown(“Jump”);
m_Jump = Input.GetMouseButtonDown(0);
Comments
Post a Comment