using UnityEngine;
public class Accelerator : MonoBehaviour
{
float speed = 8.0f;
float angularSpeed = 360.0f;
void Update()
{
Vector3 dir = Vector3.zero;
// dir.x = Input.acceleration.x;
// dir.z = Input.acceleration.y;
dir.x = Input.acceleration.x * -1;
dir.z = Input.acceleration.y * -1;
if (dir.sqrMagnitude > 1)
dir.Normalize();
dir *= Time.deltaTime;
transform.Translate(dir * speed, Space.World);
transform.Rotate(new Vector3(dir.z, 0, -dir.x) * angularSpeed, Space.World);
}
}