Mousefollow script troubleshooting

Hi everybody.
I´ve a project with a simple gameobject that is moved by the mouse (sounds pretty amazing, I know:) …the thing is after hitting play, the gameobject moves forward automatically.

This is the code:

var smooth = 5.0;
var tiltAngle = 30.0;
function Update () {

  • var halfW : float = Screen.width/ 2;*

  • transform.position.x= (Input.mousePosition.x -halfW )/halfW;*

  • var halfH : float = Screen.height/3;*

  • transform.position.z= (Input.mousePosition.y -halfH )/halfH;*

var tiltAroundZ = Input.GetAxis(“Mouse X”) * tiltAngle;
var tiltAroundX = Input.GetAxis(“Mouse Y”) * tiltAngle;
var target = Quaternion.Euler (tiltAroundX, 0, tiltAroundZ);
transform.rotation = Quaternion.Slerp(transform.rotation, target,
Time.deltaTime * smooth);

Any help will be really appreciated .

Thank you very much!!

try putting the gameobject at 0,0,0 before start?

Previously tested and it didn´t work (z translates from 0 to 2.2 and x to 0.3…)