How to roll sphere continously and after some time say 40sec it should stop

or it should get destroy…plz help me…i am also done with code but sphere is only rolling when i press right button or arrows…and i want it to rotate in only one direction…here is code
var speed :float= 5.0;
private var controller :CharacterController;
controller = gameObject.GetComponent(CharacterController);

private var moveDirection = Vector3.zero;
private var forward = Vector3.zero;
private var right = Vector3.zero;

function Update()

{

transform.Translate(Vector3(0,0,-speed) * Time.deltaTime);
forward = transform.forward;
right = Vector3(forward.z, 0, -forward.x);

var horizontalInput = Input.GetAxisRaw(“Horizontal”);
var verticalInput = Input.GetAxisRaw(“Vertical”);

var targetDirection = horizontalInput * right + verticalInput * forward;

moveDirection = Vector3.RotateTowards(moveDirection, targetDirection, 200 * Mathf.Deg2Rad * Time.deltaTime, 1000);

var movement = moveDirection * Time.deltaTime * 2;
controller.Move(movement);

transform.rotation = Quaternion.LookRotation(moveDirection);

if (targetDirection != Vector3.zero)
{
transform.rotation = Quaternion.LookRotation(moveDirection);
}
}
@script RequireComponent(CharacterController)

plz help…

Hi sidhesh,

This type of question should go in Unity Answers, where new users can seek guidance on such matters. Furthermore, it is not an iOS specific question and should go in Scripting.

You WILL get help quickly on Answers.

Cheers,

Gregzo

thnx…