Cardboard + Oculus on Unity 5

posted in: Unity | 0

This tutorial shows you how to integrat the Cardboard SDK AND Oculus SDK into a unique Unity project.

 

The maining is to build a project for each platform with minimum changes.

 

 

First, integrate the Carboard SDK following the online tutorial
Once you make it works, all you have to do is being able to disable it using this snippet code :

Cardboard.SDK.VRModeEnabled = true;
// Don't forget to recenter the view
Recenter();
 
// Dont forget to deactivate the Rotaction and Position tacking
_cardboardHead.trackRotation = true;
_cardboardHead.trackPosition = true;
Now, all you need to do is to deactivate the Cardboard SDK while on non mobile platforme, like this

public void Awake()
{
   #if !UNITY_ANDROID
   Is3DMode = false;
   #else
   Is3DActivable = true;
   #endif
}
In Unity 5 all you have to do is activate the “Virtual Reality Supported” option in Player Settings. More infomation online.

 

Once this is done, your simple switch code will do the job.

 

As simple !

 

Have an example of use with Asteroids VR

Leave a Reply

Your email address will not be published. Required fields are marked *