単眼VR用スクリプト
using System.Collections; using System.Collections.Generic; using UnityEngine; public class gyroCam : MonoBehaviour { // Use this for initialization void Start () { Input.gyro.enabled = true; } // 横位置用 void Update () { transform.rotation = Quaternion.AngleAxis(90.0f,Vector3.right)*Input.gyro.attitude*Quaternion.AngleAxis(180.0f,Vector3.forward); } }
スマートホンのジャイロに応じてカメラが移動します.Androidはジャイロが搭載されていない機種も多いので使えないこともあります.