I am using an empty game object with a triggered collider at the back of the plane (where I hit)
I am using this script:
using System.Collections;
using UnityEngine;
public class explode: MonoBehaviour {
public GameObject explosion;
void OnTriggerEnter(Collider other)
{
if (other.tag == "bullet")
{
Destroy (transform.parent.parent.gameObject);
Instantiate(explosion, transform.position, transform.rotation);
}
}
}
I attributed the script to the game object. When I crash my plane into the collider it explodes but when I shoot at it with a bullet it doesn’t. I don’t know if this is because the shot bullets are clones.