2D follow mouse script help!

i have this script that i was following on youtube to get a feel for scripting.

i used this code

#pragma strict

var myCamera : Camera;

function Start () {

}

function Update () {
    var vec : Vector3 = myCamera.ScreenToWorldPoint(Input.mousePosition);
    vec.x = 0.0;
    transform.position = vec;
}

the left and right works good but up and down is back words:( how can i fix this?.

Try adding vec.y = vec.y * -1; See if this works!

1 Like

thank you it works:)