Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using UnityEngine;
- using UnityEngine.XR;
- public class VRModeSwitcher : MonoBehaviour
- {
- public Transform MainCameraTransform;
- void OnEnable ()
- {
- StartCoroutine (SwitchToTracked2D ());
- }
- // 2D but also with head tracking enabled:
- IEnumerator SwitchToTracked2D ()
- {
- XRSettings.enabled = false;
- XRSettings.LoadDeviceByName ("cardboard");
- yield return null;
- }
- void Update ()
- {
- MainCameraTransform.localRotation = GvrVRHelpers.GetHeadRotation ();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement