Unless you’ve been living under a rock, you should be fascinated (or at least intrigued?) by VR. Check out some articles that gave me inspiration:
- From product design to virtual reality by Jean-Marc Denis
- A month designing in VR by Julius Tarng
- Designing for virtual reality by ustwo
After some investigation, turns out it’s actually not that hard to make a VR app, even if you don’t have any 3D or coding experience. Just to give you an example, here is an app I made using this method.
Tools you need:
- A VR headset (I have Google Cardboard, but others will work just fine.)
- Unity (Download and install the free version)
- Android SDK (Download from the SDK Tools Only section. I’m using Android as an example, but iOS should work as well.)
- Cardboard Unity SDK (Download from Github repo)
- An auto walk script made by Jupp Otto (Download from Github repo)
The app we’ll be making is a simple virtual environment tour. You can toggle auto walk using the trigger in your VR headset.
Step 1: Create a virtual environment
- Open Unity. Create a project in the pop up window. No need to modify any settings at this point.
- I’ll be using this Forest Environment free asset created by Patryk Zatylny, but you can use whatever asset you like. Open the URL, click “Open in Unity”. Unity will load it in the Asset Store panel. Then click “Download” (Unity doesn’t allow downloading asset directly from the web page).
- After the download is finished, you’ll see a pop up. Click “Import”.
- Navigate to your Project panel (If you can’t find it, go to top menu bar, Window > Layouts > Default). Double-click the demoScene_free file in the file structure (use the slider in the lower right to change thumbnail size). Now you can see the beautiful view in the Scene panel.
Step 2: Set up Cardboard Unity SDK
- In the Hierarchy panel, delete First Person Controller and Main Camera.
- Unzip the Cardboard SDK you downloaded from the Github repo, you get a cardboard-unity-master folder. In the top menu bar, go to Asset > Import package > Custom package, choose CardboardSDKForUnity in the cardboard-unity-master folder. In the next pop up, click “Import”.
- In your Project panel, you’ll see a Cardboard folder. Go to the Prefabs subfolder, drag CardboardMain and drop it in the Scene.
- Test it out by clicking on the play button. Use your mouse/trackpad and alt/control keys to simulate camera pan/tilt. When you are not in play mode, you can modify the initial position of CardboardMain using the Transform section in the Inspector panel all the way on the right, or using the transform tools in the toolbar in the upper left. (More details on how to position things in Unity)
Step 3: Add an auto walk function
- Unzip the auto walk script you downloaded from the Github repo, you get a Google-Cardboard-master folder. Drag the Autowalk.cs file and drop it in the Assets folder in the Project panel.
- Click to select CardboardMain in the Hierarchy panel, click “Add component” in the Inspector panel all the way to the right, find Autowalk and select it.
- You’ll see a new Autowalk section in the Inspector panel. Check “Walk When Triggered” and set the speed to 1 (or whatever you like). Now in play mode, you can use mouse click/trackpad tap to simulate the trigger to see autowalk in action!
Step 4: Package the app
- Go to top menu bar, File > Build settings. Select Android and click on “Player settings”. Enter a Company Name (up on the top) and a Bundle Identifier (in the Other Settings section down on the bottom). In Resolution and Presentation section, change Default Orientation to Landscape Left.
- Scroll down to Publishing Settings. If you don’t have a keystore, check “Create New Keystore”, enter your password, and click “Browse Keystore”. In the pop up, enter a name for your keystore and click “Save”. Now you should see the file path of your keystore next to “Browse Keystore”. (More details on signing an Android app)
- In the “Key” section below, in the Alias dropdown, select “Create a new key”. Enter your info in the pop up and click “Create Key”.
- Optionally you can add your app icon in the Icon section. Click “Build” in the Build Settings window. During the process, you might get asked to select the root Android SDK folder. Unzip the Android SDK file you downloaded and select that folder. You might also get asked to update SDK. Just confirm to update. After the build is finished, you can install the app on your Android phone, test it out with you VR headset, or even upload it to Google Play Store! (Sometimes when you rotate your head the camera doesn’t rotate with you. Exiting and reopening the app should fix it. It might have something to do with the SDK version & Android version. Let me know if you find out more details about this bug.)
You are done! That wasn’t too hard, was it?
- Manage your expectations. It’s unlikely that you can build the next Land’s End or Google Cardboard Design Lab on your first attempt. Start with something small and keep building on top of it. Lower your expectations, under-promise and over-deliver.
- If we want VR to be successful, we need better tools, because have you seen the Unity interface? There needs to something like “Squarespace for VR” to lower the barrier and get more people involved.
Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.
If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!