android accelerometer left right

I’m trying to create android app that makes use of the accelerometer, to do so I’m using this script:
#pragma strict

function Update ()
{
transform.Translate(Input.acceleration.x, 0, -Input.acceleration.z);
}

in this way, the controlled object moves back and forth to the right and left, but I want to move only left and right. how can I fix it?

x means horizontal z means depth and y means height. you include -input.acceleration.z in your code. get rid of it:

function Update{
transform.Translate(Input.acceleration.x,0,0);
}

function Update () { transform.Translate(Input.acceleration.x, 0,0); }

will do

Translate takes 3 values: horizontal=x vertical=y and depth=z

transform.Translate(x, y, z)

you include -Input.acceleration.z wich is the source of the back and forth movement.
get rid of it:

function Update () { transform.Translate(Input.acceleration.x, 0, 0); }