Question by
AJ01 · Jan 04, 2017 at 04:34 PM ·
cameramobilegyroscopewindows phone
Using gyroscope to control a camera?
I'm trying to use a phones (Windows Phone to be exact) built in gyroscope to move the camera around for use in a VR headset. I've managed to get the gyroscope to move the camera but the result is way too fast rotation and very jittery movements. Was wondering if there is a way to slow down the input? Here's the code I'm currently using:
using UnityEngine;
using System.Collections;
public class Gyro : MonoBehaviour
{
void Start ()
{
Input.gyro.enabled = true;
}
void Update ()
{
transform.Rotate (0, -Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, -Input.gyro.rotationRateUnbiased.z, 0);
}
}
Comment
Answer by $$anonymous$$ · Feb 03, 2017 at 08:44 PM
I think this could work:
void Update ()
{
player.transform.Rotate (-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, -Input.gyro.rotationRateUnbiased.z);
}
Take a look at this as well: http://answers.unity3d.com/questions/970891/rotating-a-camera-using-the-gyroscope.html
Your answer
Follow this Question
Related Questions
Rotate camera like VR on mobile 3 Answers
Limit Z axis rotation on main camera (BUG?) 0 Answers
Grey/Dark line between two cubes 1 Answer
Unity gyroscope in 2D 1 Answer
Virtual Reality camera 0 Answers