- Home /
Gameobject won't rotate using gyroscope - C#
What I'm trying to do is make the player rotate with the rotation of the gyroscope. However when I test it nothing happens.
Code:
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;
}
}
Comment
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
How to make Camera position Independent of its Rotation? 1 Answer
Rotating Camera around player object 0 Answers
Object instantiate, Projectile problems 2 Answers
Distribute terrain in zones 3 Answers