Why does my trigger trigger another trigger?

This makes no sense. If I wanted to trigger the trigger, I’d do it with a collider, not a trigger. Let me explain…

  1. I have an NPC enemy RigidBody with a capsule collider on the same component. A child object has a box trigger with no RigidBody.

  2. I have a projectile also with RigidBody and box collider along the shaft of an arrow. At the arrowhead, I have a child GameObject with no RigidBody but with a sphere trigger. Attached to this child arrowhead with the trigger, I have a script with the following bit of relevant logic:

    private void OnTriggerEnter(Collider other) {
          print(other.name);
     }

It prints the name of the trigger described in 1), rather than its capsule collider. Is this a bug or working as intended? The arrow sticks with position/rotation transforms, so it stops at the first thing it hits. I need the arrow to go through the trigger and hit the collider. Is this not possible? Unfortunately, I need the trigger on in 1) for something else, so I can’t just get rid of it.

Well, I found the following chart which answers my question:

I guess I’m going to have to rework pretty much everything related to colliders/triggers… Really, I don’t see the point of triggers at all now. Might as well use a kinematic collider instead…

1 Like

Before you redo everything, be aware that you can control which game objects can collide with other game objects by using Layers: Unity - Manual: Layer-based collision detection

For example, if you’re getting collisions between two things and you don’t want those collisions, put the two objects on different layers, and disable collisions between those layers.

2 Likes

Thanks @dgoyette , that’s what I wound up doing. It’s a good system, but the trigger aspect is not intuitive.

Thank you very much! This solved my problem without re-writing all the code in multiple scripts!