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

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373>\
**Category:** Audio\
**Tags:** tags, overlap-actors, trigger-volume, unreal-engine, question\
**Created:** [October 23, 2020, 3:05pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373 "2020-10-23T15:05:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_octadd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mike\_octadd](https://forums.unrealengine.com/u/Mike_octadd)\
**Post date:** [October 23, 2020, 3:05pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373/1 "2020-10-23T15:05:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 23, 2020, 3:12pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373/2 "2020-10-23T15:12:29Z")

</div>

Look into object and collision channels:

> **[Add a Custom Object Type to Your Project](https://docs.unrealengine.com/5.0/en-US/add-a-custom-object-type-to-your-project-in-unreal-engine/)**
>
> How To add a custom physics object channel to Unreal Engine.

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

* * *

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

> **[Collision Filtering in Unreal Engine 4](https://www.unrealengine.com/en-US/blog/collision-filtering)**
>
> Choosing what collides is obviously very important, but it can be tricky, and it’s a problem that we have spent quite a while discussing while developing UE4. The system we have can seem a little complex at first, but it is very powerful and...

---

<div class="post-metadata">

**Author:** ![Mike\_octadd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mike\_octadd](https://forums.unrealengine.com/u/Mike_octadd)\
**Post date:** [October 23, 2020, 3:22pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373/3 "2020-10-23T15:22:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 23, 2020, 4:08pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373/4 "2020-10-23T16:08:01Z")

</div>

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

 ![319832-johns.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/0/8/008a605c05168fac40711a46945b6b077101579c.jpeg)

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.

 ![319836-room.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/9/079fb905fc1b270a17aa3adc44e234615af93b58.jpeg)

Hopefully that’s closer to the expected result:

 ![319837-screenshot-2020-10-23-165720.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/2/b/62b5365a3f3f06a806a2d36d668c80eb04570a56.jpeg)

---

<div class="post-metadata">

**Author:** ![Mike\_octadd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mike\_octadd](https://forums.unrealengine.com/u/Mike_octadd)\
**Post date:** [October 23, 2020, 4:18pm UTC](https://forums.unrealengine.com/t/how-can-i-get-only-the-smallest-trigger-volume-im-overlapping/473373/5 "2020-10-23T16:18:27Z")

</div>

Thanks, man! That helped a lot!
