If you preffered to not use triggers , you could also do:
void OnColliderHit(Collider other)
{
if(other.gameObject.tag == "Target")
{
Destroy(other.gameObject);
}
}
If you wanted to make the projectile hit everything it collides with, you'd do
void OnColliderHit(Collider other)
{
Destroy(other.gameObject);
}
instead.
↧