Hello. I need some problem solving help. I want objects to be fly up from below the camera’s view, but when they fall back down and reach the bottom of the screen, be destroyed. How would I accomplish this? Currently, when I spawn an object (which has a rigidbody), I add a relative force to move it up. The “barrier” object then has a script attached that detects if another collider has entered it’s trigger, and then destroys the object that entered the barrier. But, then objects cant pass through the barrier on their way up. Thanks
Create a “transparent” plane game object on your bottom of the screen. when the object is falling down and when it collides plane, it will destroy.
First you need to add a tag called “plane”, and tag the plane as “plane”. After that attach the below script on the object that you want to make it acts like what you asked for.
function OnTriggerEnter (other : Collider)
{
if (other.attachedRigidbody.gameObject.tag == “plane”)
{
Destroy(this.gameObject);
}
}