Skip to content

Instantly share code, notes, and snippets.

@mostafanastary
mostafanastary / GyroCamera.cs
Created July 20, 2020 23:17 — forked from kormyen/GyroCamera.cs
Unity3D script for rotating camera with a phone's gyro. Includes smoothing and initial offset. Edited from https://forum.unity3d.com/threads/sharing-gyroscope-camera-script-ios-tested.241825/
using UnityEngine;
using System.Collections;
public class GyroCamera : MonoBehaviour
{
// STATE
private float _initialYAngle = 0f;
private float _appliedGyroYAngle = 0f;
private float _calibrationYAngle = 0f;
private Transform _rawGyroRotation;