- Home /
Question by
animeman0 · Jul 03, 2016 at 10:57 AM ·
c#rotationgameobjectgyroscope
Gameobject rotation using gyroscope
I'm trying to rotate a gameobject using the gyroscope but nothing happens.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
Gyroscope gyro;
Quaternion rotation;
float move;
public float rotationSpeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
move = Input.GetAxisRaw("Horizontal");
Quaternion rotation = Quaternion.Euler(Vector3.forward * move * rotationSpeed);
//transform.rotation = rotation * transform.rotation;
transform.rotation = Input.gyro.attitude;
}
}
Thanks in advance!
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612084138im_/https://answers.unity.com/themes/thub/images/avi.jpg)