Question by
Gianluca90 · Dec 15, 2016 at 09:00 AM ·
androidvrmobileapplicationunity remote
How to enable head tracking in Gear VR via Unity Remote 5 on android?
I'm creating a Gear VR app, I want test it via unity remote 5...Any idea?
Comment
Best Answer
Answer by Gianluca90 · Dec 15, 2016 at 10:52 AM
I found the solution. Put the MainCamera into a empty object with Player tag and add this script into MainCamera:
using UnityEngine;
using System.Collections;
public class GyroRotate : MonoBehaviour {
private Gyroscope gyro;
void Start ()
{
if (SystemInfo.supportsGyroscope)
{
gyro = Input.gyro;
gyro.enabled = true;
}
else
{
Debug.Log("Phone doesen't support");
}
}
void Update ()
{
GameObject player = GameObject.FindGameObjectWithTag ("Player");
player.transform.Rotate (-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, 0);
}
void OnGUI()
{
GUILayout.Label ("Gyroscope attitude : " + gyro.attitude);
}
}
Your answer
Follow this Question
Related Questions
Oculus Go storage file path 3 Answers
Multiple Scenes for iOS 2 Answers
In Gear VR, is it possible to start the game without VR, and turn VR on via script? 1 Answer
Unity Remote 5 Not Connecting 3 Answers