hello together
i cant find out how to destroy an object when it is out of the terrain.
i got this on an empty gameobject:
function falling() {
var instance : GameObject = Instantiate(Resources.Load("Cube"));
transform.position.x=930;
transform.position.y=11;
transform.position.z=1074;
}
InvokeRepeating("falling", 0, 3);
and this on the Cube prefab:
function OnCollisionEnter (collisionInfo : Collision) {
if (collisionInfo.gameObject.tag == "Terrain"){
//
audio.Play();
Debug.Log ("Hello");
}
}
the cubes are bouncing around and i want to destroy them when the y position is lower than the terrains y position.