Reputation: 2001
I'm making a 360 video player with the camera placed in the center of a sphere and I've implemented the gyroscope into the camera, it is working but when I move around there is weird shake going on, looks like having some sort of delay even when the phone is still. The screen orientation is locked in landscape.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Gyro : MonoBehaviour {
private Gyroscope gyro;
private bool gyroSupported;
private Quaternion rotFix;
void Start()
{
gyroSupported = SystemInfo.supportsGyroscope;
GameObject camParent = new GameObject("camParent");
camParent.transform.position = transform.position;
transform.parent = camParent.transform;
if (gyroSupported)
{
gyro = Input.gyro;
gyro.enabled = true;
camParent.transform.rotation = Quaternion.Euler(90f, 180f, 0f);
rotFix = new Quaternion(0, 0, 1, 0);
}
}
void Update()
{
this.transform.Rotate(-Input.gyro.rotationRateUnbiased.x, -Input.gyro.rotationRateUnbiased.y, -Input.gyro.rotationRateUnbiased.z);
}
}
Upvotes: 1
Views: 1335
Reputation: 2582
Using Gyro plugin in Krpano Library. Updating the Library from krpano 1.19-pr14 to krpano 1.19-pr16 fixed this issue for me
Upvotes: 0
Reputation: 263
I had the same problem. But in my case it turned out that it's the problem in most of mobile phones. May be gyro scope is not mature enough yet. Although It's not a coding problem. And you are not the only one facing this problem. I also tried many blogs that time. But there was no proper coding solution. This is a bug in circuit. NO CURE YET
Upvotes: 0