Unity Gyroscope Reset Camera Position(like oculus recenter camera)
<p>I am making a gyroscope-enabled app for android/ios where you can use your gyroscope to look around. I would like for the player to reset their camera position(recenter scene infront of device), but I cannot get a system working for that.</p>

<p>Here is the code for looking around:</p>

<pre><code>using UnityEngine;
using System.Collections;

public class CameraControl : MonoBehaviour {
    void Start () {
        if (SystemInfo.supportsGyroscope) {
            Input.gyro.enabled = true;

            //Create parent object and set this object's parent to that
            GameObject camParent = new GameObject ("CamParent");
            camParent.transform.position = transform.position;
            transform.parent = camParent.transform;

            // Rotate the parent object by 90 degrees around the x axis
            camParent.transform.Rotate (Vector3.right, 90);
        }
    }

    void Update () {
        if (SystemInfo.supportsGyroscope) {
            Quaternion rotation = new Quaternion (Input.gyro.attitude.x, Input.gyro.attitude.y, -Input.gyro.attitude.z, -Input.gyro.attitude.w);
            transform.localRotation = rotation;
        }
    }

    void OnGUI () {
        if (SystemInfo.supportsGyroscope) {
            GUILayout.Label (transform.localRotation.ToString());
            GUILayout.Label (transform.parent.rotation.ToString());

            if (GUILayout.Button ("Recenter View")) {
                //RECENTER THE CAMERA VIEW
            }
        }
    }
}
</code></pre>