tilt device , roll the ball

hello all,
i am 3d cg artist, i am new to unity, and need help from you.

i am trying to make a simple game “labyrinth”
my logic is when player tilt the device , ball rolls appropriate,
i have created 3d assets for this in unity, can handle physics a bit, but low on scripting,
can anybody helps me out, from start what to do ?
thanks.

i am applying this script on ball, but when runs the build on device nothing happens :frowning:

#pragma strict

var tilt : Vector3 = Vector3.zero;
var speed : float;
private var circ : float;
private var previousPosition : Vector3;

@script RequireComponent(Rigidbody)
function Start()
{
//Find the circumference of the circle so that the circle can be rotated the appropriate amount when rolling
circ = 2 * Mathf.PI * collider.bounds.extents.x;
previousPosition = transform.position;
}

function Update () {
tilt.x = -Input.acceleration.y;
tilt.z = Input.acceleration.x;

rigidbody.AddForce(tilt * speed * Time.deltaTime);

}

function LateUpdate()
{
var movement : Vector3 = transform.position - previousPosition;

movement = Vector3(movement.z,0,  -movement.x);

transform.Rotate(movement / circ * 360, Space.World);

previousPosition = transform.position;	

}

Try to apply the Input.acceleration to the rigidbody.velocity:

rigidbody.velocity = tilt * speed;

You may need some values to make the object move to theappropriate speed but that is what we use for similar purpose.