Continuous Overlap while in motion?

I want to have certain events fire while my character is overlapped with a region (which is defined by a knee-high skeletal mesh for fog purposes). To this end I have the region registering to receive an OnTick event from the character on BeginOverlap, and unregistering the event on EndOverlap. This works okay when I enter the region and immediately stop; the problem arises when I keep moving while within the region: BeginOverlap events are followed immediately by EndOverlap events for as long as I remain in motion, and my OnTick never gets called.

What can I do to correctly detect when the character enters and remains in the region so I can properly apply continuous effects?

Use a gate with Event Tick. Open the Gate On Begin Overlap, and Close it on End Overlap.

2 Likes

Or:

1 Like

Okay, I did not know the Gate node was a thing; it looks really cool and I will definitely file it away for the right time to use it; unfortunately in this case, it would just be decorating the problem instead of fixing it, as the EndOverlap would still be closing the gate before the Tick ever fires.

I did come up with an idea in the shower this morning, to use a kind of double lock, where the EndOverlap doesn’t actually unbind my event, but sets a variable that the overlap has ended, which will notify the Tick event to do the Unbind after its normal execution. Of course, this runs into the same problem that required the use of the Tick event from the overlapped Actor in the first place, that the first Actor needs to know what Actor it is overlapping with with (this also prevents use of the second suggestion, at least as written).

The second option might have the glue necessary to fix it, however. Since I am already getting the overlapped Actor from my modified Tick event, I should be able to use that to check IsOverlappingActor, and do the Unbind if it isn’t. This would move all the EndOverlap functionality to the OnTick, so I have one less event to worry about, to boot.

Of course, I won’t be able to test this for another 8 hours or so, so we’ll just have to wait and see.

This worked:

In case it isn’t clear, the target for the Unbind is the marked Actor Component, Elemental Saturation, which is reporting itself in the custom tick event.

None of this helped me. If you’re in my boat, check what COMPONENT of the actor is being overlapped by the event (i.e. Other Comp). In my case, it was some useless widget component that I didn’t even need that was the culprit. Overlaps are back to normal ever since I changed it to an actor component.