How can I get only the smallest trigger volume I'm overlapping?

Look into object and collision channels:

This way you can have specific objects respond to specific channels.


Also, if you ever need to know more about how channels work:

Hey, guys! So, I have a system that uses a trigger to create a cluster of objects it’s overlapping. When I go inside the trigger I need to check if the trigger has a certain tag and if so get the objects that are ALSO being overlapped by that same trigger. My problem is that these triggers represent rooms, so when I have a small room inside a bigger room they’ll get all the objects overlapped by both triggers (Since we are overlapping with both). So I need help trying to figure out how to get ONLY that smaller room.

It would be nice if they had priorities like an Audio Volume.

Thank you

Thanks Everynone, but the problem is that when I’m outside the smaller room the bigger room should get the specific objects. Maybe the question wasn’t clear, but let’s say I need to know how many Johns are in the room as soon as I enter. So let’s say that I have a bigger room with 5 Johns and a smaller with 3 Johns, when I enter the bigger room it should know it has 5 Johns and when I go into the smaller it should get 3, but because when I’m in the smaller room I’m also overlapping with the bigger one, I get 8.

Ah ok, much clearer. I believe you’re after set difference here. Consider the following:

  • small room in the middle (3 johns)
  • large room on the outside (8 johns) - but we want to exclude the ones that are in the small room so we should end up with 5 only

Below, we detect the overlapping Johns and add them to [Sets][2]. Initially we end up with 3 in the small and 8 in the large, as expected. But sets can (very efficiently!) exclude the undesired elements.

Hopefully that’s closer to the expected result:

Thanks, man! That helped a lot!