Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cosc 5/4735 Unity and Cardboard VR.

Similar presentations


Presentation on theme: "Cosc 5/4735 Unity and Cardboard VR."— Presentation transcript:

1 Cosc 5/4735 Unity and Cardboard VR

2 Unity3D and Google VR Much like OpenGL, android has produced a “plugin” for unity. You can use the asset at the start or add it in to already formed project. Directions assume Unity f1 Download gvr package for unity

3 Adding VR to unity Assets -> Import package -> Custom Package
Find the GoogleVRForUnity…unitypackage file (where you downloaded it) Import everything. Existing project: Select the camera (either MainCamera or FirstPersonCharacter Camera) From menu, Component -> Google VR->Update Stereo Cameras You now have Cardboard ready cameras.

4 Adding VR to unity (2) For a new project
Delete the MainCamera and add the GvrMain prefab It has everything to control the VR mode.

5 Play mode in Unity. Mouse-based head tracking:
if you press Alt and move the mouse around, you can pan horizontally and tilt vertically around your scene as if your head is moving Cardboard around. Use Ctrl with the mouse to simulate tilting your head from side to side. Simulating trigger pulls: use a mouse click to simulate the action of a user using the trigger.

6 Trigger Pulls Add the following script:
public class NewBehaviourScript : MonoBehaviour {     public Text textView;     void Update()    {         if (Cardboard.SDK.Triggered)        { //deal with trigger here         }           } } Add the script via the Add Component button Likely to the FirstPersonCharacter.

7 A note Build & Run on unity
If you get Key error, it’s a known problem in unity3D. It’s having problems with the data connection to that phone. Works on my Moto G, fails on the Nexus 5X Try just Build. Cmd prompt: adb install –r file.apk -r is replace, so you can do it multiple times with the same version number.

8 References

9 Q A &


Download ppt "Cosc 5/4735 Unity and Cardboard VR."

Similar presentations


Ads by Google