I just wanted to ask how to get the x and z position of my mouse cursor.
I need for my rts-style game. I have a button and when the player presses it, the game initiates my house prefab. But i find myself unable to create it at my mouse coordinates. I only can create it at some defined points ( 0, 1, 0).
My code looks as follows for the moment:
var house : Transform;
var z = RaycastHit.point.x;
var x = RaycastHit.point.z;
function OnGUI () {
if (GUI.Button (Rect (10,10,100,30), "Domek")) {
Instantiate (house, Vector3( x,1, z), Quaternion.identity);
}
}