Muhammad Faizan Khan
Muhammad Faizan Khan

Reputation: 10571

Do child trigger runs parent trigger also?

I have a gameObject whose hierarchy contains

  1. parent contains box collider, kinematic rigidbody and script that contains OnTriggerEnter event.
  2. Parent's first child contains box collider
  3. Parent's first child of a child contains box collider and script contains OnTriggerEnter
  4. Parent's first child of seconds child contains box collider and script contains OnTriggerEnter My simple question is do child trigger will run parent trigger also I have did it. it seems true and surprising!

Upvotes: 4

Views: 15842

Answers (1)

Gunnar B.
Gunnar B.

Reputation: 2989

They do if the child does not have a (kinematic) rigidbody. In this case the collider of the parent basically is the sum of all colliders of itself and it's childs (compound collider).

If you want them to behave individually, they need their own kinematic rigidbodys. Make sure they ignore each other in the OnTrigger though (e.g. via tag).

Upvotes: 17

Related Questions