- Home /
Question by
Witherik · Sep 02, 2015 at 06:13 PM ·
rotationaccelerometer
I want to rotate an object by the Y axis using the phones accelerometer
I know that I am doing something wrong, but I am tired of searching for the right an answer
here is the code bellow
using UnityEngine; using System.Collections;
public class Rotation : MonoBehaviour {
public float speed = 10.0F;
void Update() {
transform.Rotate(Vector3.up, Input.acceleration.z * Time.deltaTime);
}
}
Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612002412im_/https://answers.unity.com/themes/thub/images/avi.jpg)