Hello everyone,
what i’m trying to do here is to Instantiate a prefab by moving the mouse to the right place and click. then it just Instantiated. i succeed to make it appear but the problem is the wrong position. the mouse coordinates are just so wrong. to understand the problem here’s a ![picture
][1] to what i’m trying to accomplish . and the code the i used is this:
#pragma strict
var ThePrefab : GameObject;
function Update () {
var mousePos = Input.mousePosition;
print(mousePos.x + " " + mousePos.y);
if(Input.GetKeyDown("q")){
var instance : GameObject = Instantiate(ThePrefab, Vector3(mousePos.x,mousePos.y,0), transform.rotation);
}
}