How can I make trigger overlapping persistent?

I have set up a trigger that makes the player crawl when colliding with it (sort of when entering a duct or going under a table).

When the player begin overlap/end overlap the trigger, it toggles a bool that tells the logic to resize the capsule height.

The problem comes when there are two of these trigger together, as when the player hits the first one everything works as intended, but when he moves to the second, instead of of keeping the overlap it ends overlapping after exiting the first trigger, and do not keep the begin overlap with the second until the player exit and re-enter again.

Its a little hard to explain, but any idea on how to fix this?

1 Like

Here’s an idea how this could work:

  1. Create and add an actor component to the trigger box actor, this will handle the communication with the overlapping actor.


  2. This is all you need on the overlapping actor side:


Result:
ContinousOverlap


Hope it helps.

3 Likes

Another workaround is keep a counter on the begin overlap/end overlap.
You add 1 when you begin overlap and you substract 1 when you end overlap.
if the value >= 1 then you are inside the duct.

The above solutions are great.
An idea from another perspective for consideration: Avoid the overlapping.
Maybe a tool could be made, and the tool can take in multiple volumes and output a single merged volume object for that collision logic. I think maybe that could be more flexible.
With UE5’s new geometry scripting feature, I think it should be fairly easy to do.
Hope that helps.

Yep, this indeed is a pretty simple and solid solution, thank you :slight_smile:

1 Like

I just started today with Unreal 5 after I managed my computer to run it… why should I avoid overlapping? also, may I get more info about that new geometry scripting?