Showing posts with label VR. Show all posts
Showing posts with label VR. Show all posts

Friday, December 16, 2016

Google Cardboard Input

Successfully setting up input for Google Cardboard has a lot to do with applying scripts to the right place.  This post will cover what I've found to be the minimal set to get this working.

Please follow the setup steps in this Post as a prerequisite, as you'll need to have loaded the SDK package into your project, and added a GvrMain to your scene.

Setup the Scene

  1. On the GvrMain
    • Add the GvrPointerManager script
  2. On the Main Camera under the GvrMain
    1. Add the GvrPointerPhysicRaycaster script
    2. Add a GvrReticlePointer prefab as a child of the Main Camera
  3. Add an EventSystem to the scene
    1. Remove the StandaloneInputModule script
    2. Add the GvrPointerInputModule

Tuesday, December 13, 2016

Add a Spatial Sound

Making use of the Google Cardboard SDK, you can add spatial sounds to your scene that react to head direction changes.

You can add a spatial sound in two ways:

  • Drag a GvrAudioSource prefab into your scene
  • Add the GvrAudioSource script to your object
Ensure that your project settings have the Audio value of Spatializer Plugin set to the GVR Audio Spatializer.

Edit > Project Settings > Audio


You also may have to enable the GvrAudioListener script that resides on the GvrMain > Head > MainCamera game object.  This is provided as a part of the prefab.

At this point, when you play your game, you should hear the sound (assuming the source is in range), and as you turn your head, you should hear the sound move accordingly.

Saturday, December 10, 2016

Google Cardboard Integration

Integration with Google Cardboard was not trivial, and I ran into several hiccups, but here is the process of getting Google Cardboard building and deployed with Unity (5.5.0f3)


  1. First install the Android Studio to get the Android SDK on your computer
  2. Next, download the Google VR SDK for Unity
  3. Create a new Unity Project
  4. Assets > Import Package > Custom Package
    1. Navigate to where you downloaded the Google VR SDK, select package
    2. Deselect the following
      1. Google VR > Demos
      2. Plugins > Android > gvr-permissionsupport-release.aar
      3. Plugins > iOS
    3. Click Import button
    4. Go Ahead with "API Update Required"
  5. There is at least one script with a compilation error
    1. Find the script error in the console, or just open GvrVideoPlayerTexture.cs
    2. Line 595 - add a "yield" before the "return false;"
  6. Allow extra import packages to be loaded "GVRBackwardsCompatibility"
  7. Delete the Main Camera
  8. Add a GvrMain prefab to your scene (this is your VR camera)
    1. Add other elements to your scene as desired
  9. File > Build Settings
    1. Select Android
    2. Player Settings > Identification > Bundle Identifier (update this field)
    3. Build
    4. When asked about Android 6.0 Platform requirements, click Continue
    5. If it complains about "Merging Android Manifests", you'll need to find the gvr-permissionsupport-release.aar file and manually delete it.