- Home /
Question by
Denzillah · Jun 16, 2013 at 09:19 PM ·
Problem to make fireball destroyed when touch terrain, and destroy the clones of it..
Hello,
I'm really new to Unity, and I'm having a problem.
I've put a script on my Fireball-projectile. Each fireball I shoot I want to get's destroyed when touching my terrain, now it just bounces away when it touches it. Also I've made some stupid script (I have no Idea what I'm doing) so I can only shoot for 2 seconds, I want the projectile to get destroyed after 2 seconds if it dosen't hit anything. And also delete the clones. For now on I want infinite ammo, so nothing about that.
Also I need to make a explosion-animation-script for my projectile.
This is what I've used:
function Update () {
Destroy (this.gameObject, 2);
}
function OnTriggerEnter(){
Destroy (this.gameObject);
}
function OnCollisionEnter ( collision : Collision) {
if (collision.collider.name == "Projectile")
Destroy (GameObject.Find("Projectile"));
}
THANKS FOR THE HELP!
Comment
Answer by bubzy · Jun 16, 2013 at 09:21 PM
possibly
Destroy (GameObject.Find("Projectile").gameObject);
Your answer
