unity 2d roll a ball using accelerometer
// Roll a ball with accelerometer public float sensitivity = 1.0f; // how sensitive is the accelerometer void Update() { // float moveVertical = Input.GetAxis("Vertical"); // for keyboard float moveHorizontal = Input.acceleration.x; // for accelerometer Vector3 movement = new Vector3(moveHorizontal, 0.0f, 0.0f); rb.AddForce(movement * sensitivity); // speed }