roll ball in two axis using devices accelerometer.

Hi, every one

I want to make simple roll ball game in android.

I have a script but it can only use x axis to roll ball using accelerometer.
can you help me too roll ball in two axis.

here’s the code…

function Update () {

    var dir : Vector3 = Vector3.zero;
      
    dir.x = -Input.acceleration.y*.5;
        
    transform.position.x += dir.x;

}

Thanx

Just guessing:

function Update () {
    var dir : Vector3 = Vector3.zero;
    dir.x = -Input.acceleration.y*.5;
    transform.position.x += dir.x;
    dir.y = -Input.acceleration.x*.5;
    transform.position.y += dir.y;
}