Hello.
I am using the following code to lock a game object to the mouse. So you click build, the game object ghost locks to mouse so you can choose where to build it. The code below works fine, but I decided to change the X rotation on the main camera to 45 instead of 90. Now the object is dissappearing below the terrain when I move down vertically and raising high above the terrain when moving up vertically. HELP!
var screenSpace = Camera.main.WorldToScreenPoint(transform.position);
var curScreenSpace = Vector3(Input.mousePosition.x,Input.mousePosition.y, screenSpace.z);
var curPosition = Camera.main.ScreenToWorldPoint(curScreenSpace);
transform.position = curPosition;