casting rays, layer masks, filter objects
An edit if you will.. When casting rays with masks/filters, remember the ray will keep going until it hits something...so if you have some junk under your floor geo, it's likely the ray will hit it. So be sure to have a function that checks the hit object somewhere.. Some code - LayerMask mask = LayerMask.GetMask("spawnObject"); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //cast ray RaycastHit hit; //create hit event variable if (Physics.Raycast(ray, out hit,50f,mask)) //if ray hits object { ...