Bug with BeginOverlap EndOverlap

Set up some actor to have a primitive to detect overlaps and the appropriate ‘OnComponentBeginOverlap’ and ‘OnComponentEndOverlap’ functions.

For the intruding actor, set ‘Collision Presets’ to ‘Custom’. Set ‘Collision Enabled’ to ‘Physics Only (No Query Collision)’. ‘Object Type’ doesn’t matter but I have it at ‘PhysicsBody’. Then make sure ‘WorldDynamic’ is set to Block.

What you’ll see is begin overlap and end overlap called every frame as long as the intruding actor is within the radius, and none firing when he’s out. Even though this setup might be unusual, it happened in my game the very first time I set it up.

Debugging the source, the code that checks for BeginOverlap just checks that ‘WorldDynamic’ is set to ‘Block’. The EndOverlap checks for Collision to be set to ‘Query Only’ or ‘Collision Enabled (Query and Physics)’ (because otherwise CollisionEnabled is set to false). Consequently every frame you’re in range, you BeginOverlap, then EndOverlap, and loops every frame. Seems like a bug to me because the conditions that send you into a state are different from the ones that release you from that state, opening the door to endless cycles.

UPrimitiveComponent::UpdateOverlaps checks to see if the object causing the overlap has collisions enabled (as in 'query only or query and physics). If it doesn’t, it calls EndComponentOverlap on all overlaps it has.

Otherwise, a warning would be nice at the very least. Took me a while to narrow this down.

Hi rantrod,

Do you have “generates overlap events” active in the overlapped objects?

Of course. The bug only appears with the conditions I specified, otherwise it behaves as expected. It’s simple enough to reproduce that I didn’t think you needed a sample project, but if you are having a hard time recreating it, I could prepare one over the weekend. The particular working case I have is in an actual production game so I can’t share that.

Are you checking these overlaps in blueprints or through C++?

I’m checking in C++

Can you send me either your assets or a project that this is shown in? I will be happy to take a look and see what may be going on.

Hi rantrod,

We have not heard from you in several days. I am marking this as answered for tracking purposes. If you are still experiencing this error, please comment with the requested information.

Since I can’t send any work stuff, I had to wait for the weekend to recreate it at home (install the same version of UE4, copy the same exact source files, etc). However, at home it would not happen so I assume it’s some modification some knuckle-head made at work. I’m tracking it down today. Thanks for looking into this though. I’m embarrassed and sorry I took time away from you guys :frowning: