I’ve been reading that for OnTriggerEnter you only need one of the gameObjects to be a rigidbody.
Now that worked just fine for my Tower to detect my Enemy. But when my Tower shoots at the Enemy, the bullet trigger does not work unless I also add a rigidbody to it.
Why is that? The enemy cube is already a rigidbody, why won’t OnTriggerEnter work for the bullet unless both the bullet and the enemy cube are rigidbodies?
Is there a better way to do it? Am I doing it the wrong way?
I hope this isn’t a bad way to ask a question, I would just like to understand how things work. Thanks in advance for any help
Edit:
Posting code as requested, they both already have tags
//enemy
function OnTriggerEnter( other : Collider ) {
if(other.gameObject.tag == "Bullet") {
Destroy(other.gameObject);
}
}
//bullet
function OnTriggerEnter( other : Collider ) {
if(other.gameObject.tag == "Enemy") {
Destroy(gameObject);
}
}