Help on a basic script

Hello. I’m fairly new to Unity, and I’m trying to make a simple barebone Android puzzle game. It’s a ball, which when you tilt, moves, and then puzzles and yada-yada-yadi-yada.
So far I have this script on the ball: (a modification of the Unity script)
#pragma strict
// Credit to Unity for this script

	// Move object using accelerometer
	var speed = 10000.0;

	function Update () {
		var dir : Vector3 = Vector3.zero;

		// we assume that device is held parallel to the ground
		// and Home button is in the right hand
		
		// remap device acceleration axis to game coordinates:
		//  1) XY plane of the device is mapped onto XZ plane
		//  2) rotated 90 degrees around Y axis
		dir.x = Input.acceleration.x * 5;
		dir.z = Input.acceleration.y * 5;
		
		// clamp acceleration vector to unit sphere
		
		// Make it move 10 meters per second instead of 10 meters per frame...
		dir *= Time.deltaTime;
			
		// Move object

		transform.rigidbody.AddForce(dir * speed);
		transform.rigidbody.AddForce(dir * speed);

		
	}

I’d like to add dampening or something similar, because currently this ball is in constant motion and that doesent allow for the player to have time to think. I’m also a bit confused about the speed, whatever I change it to it doesent change the actual speed. I made it add the force two times because that puts it at a semi-desirable level. I’d love any help.

Thanks.

For a better simulation, why don’t you just modify gravity to mimic the real world.

First, create a floor(and maybe some walls) for the ball to sit on and set its:

Rigidbody.useGravity = false;
Rigidbody.constraints = RigidbodyConstraints.FreezeAll;

Then add gravity based on acceleration:

void Update()
{ 
  Physics.gravity = new Vector3(Input.acceleration.x * 5, 0, Input.acceleration.y * 5);
}

Lastly, Modify the PhysicMaterials and masses of the ground and ball for the desired effect.

Try this

this.gameObject.rigidbody.AddForce(transform.right*50);

Or change transform.right to ur required direction