Mouse.position

Hello everyone I have a problem with this script you will know definitely help considering your experience in the program. What I want to do is move an object along the X axis with the mouse. If I move the mouse to the right in real time also moves the object. The same if I move the mouse to the left. The script works wanted ottimarlo doing so, however, that mouse is coordinated with the object because no part in the central point. I am attaching the script. thanks

var cube: GameObject;

function Start () {


}

function Update () {
******* var = x_coordinate Input.mousePosition.x;


******* cubo.transform.position = Vector3 (x_coordinate, 0.0) * Time.deltaTime;

}

First off, when posting code, you should use code tags as explained in this sticky post in this forum.

Second check out the script reference for Input.GetAxis, it is probably closer to what you need.

function Update() {
     var xMove : float = Time.deltaTime * Input.GetAxis ("Mouse X");
     cubo.transform.Translate ( xMove, 0, 0);
}

thanks for your help the next time I will remember the tag =)