Hello. So what i want is Instantiate texture on glass object and kill bot behind that glass. For instantiating holes i use this:
var bulletHole : GameObject;
function OnMouseOver(){
if (Input.GetMouseButtonDown(0)){
var hit : RaycastHit;
var hitRotation = Quaternion.FromToRotation(Vector3.back , Vector3.left);
if(Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), hit))
{
Instantiate(bulletHole, hit.point, hitRotation);
}
}
}
But objects behind glass are not receive raycast. How deal with this? How can two or more objects receive raycast if they placed behind each other?