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 :
[codesyntax lang= »csharp »]
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;[/codesyntax] Now, all you need to do is to deactivate the Cardboard SDK while on non mobile platforme, like this [codesyntax lang= »csharp »]
public void Awake() { #if !UNITY_ANDROID Is3DMode = false; #else Is3DActivable = true; #endif }[/codesyntax] 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
Laisser un commentaire