Skip to content

Instantly share code, notes, and snippets.

@tanyuan
Created June 4, 2017 12:01
Show Gist options
  • Save tanyuan/7aa4002c6e8b8cbb7192f41c5c7d5211 to your computer and use it in GitHub Desktop.
Save tanyuan/7aa4002c6e8b8cbb7192f41c5c7d5211 to your computer and use it in GitHub Desktop.
Simple 360 scene using Cardboard via Unity Remote
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gyroRotate : MonoBehaviour {
void Start () {
}
void FixedUpdate () {
Input.gyro.enabled = true;
Quaternion gyro = Input.gyro.attitude;
Vector3 gyroEular = gyro.eulerAngles;
transform.rotation = Quaternion.Euler(-gyroEular.y, gyroEular.x, 0) * Quaternion.Euler(90, 0, 0);
}
}

Unity 5.6.1f1

Edit > Project Settings > Player > Android Tab > Check Virtual Reality Supported > Split Stereo Display (non head-mounted)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment