Box Collision trigger begin and end overlap in same frame

So my blueprint works flawlessly how I need it to Until I hook the custom events up to it. (I tested it using Press and Release J key in my char blueprint to make sure it works) I hooked print strings up to the begin and end overlap and when i put the cube inside and pull it out it can tell when its been put in and pulled out perfectly. Its when i use these custom events to actually trigger the movement of my static meshes it triggers begin and end the same time (effetely making it not move) My first thought was i have generate overlap events for other meshes and it was getting multiple inputs but ONLY my box collision has that box checked. Been bug testing it for a good 5 hours and I’m lost, I think this is a bug but if anyone has other ideas/work around if you could post pics of blueprint that would be most helpful!

-Added note: The cube i use to overlap also does only have its Box collision checked to cause overlapping event.

1 Like

I think the problem is your timeline. When using a timeline, you have to establish start and end points before going into the TL.

Start is actor position, of course. Just for now set end as that + 50 in Z ( for example ) and lerp the vector position like so:

Are you sure its the timeline? When i set up my Press J in my char blueprint the platform goes up and down perfectly using the custom events. My issues is when my cube overlaps it triggers end overlap and begin overlap at the same frame, making the platform go up and down at the same time (aka not moving)

I’m surprised that timeline isn’t firing components off into space :slight_smile:

If you could try fixing that first, then I’ll take a look at the rest.

Still the same issue. Cube triggers UP and DOWN print strings making it go up and down in the same frame and doing nothing effectively !alt text[alt text][1]

Ok, thanks for doing that.

Just for now, instead of these component overlaps and events, can you try replacing the up and down events on the timeline with OnEndOverlap and OnBeginOverlap?

I do recall trying to avoid using component overlap events like this because they are messy, but I can’t remember exactly what the problem is.

Yeah same issues of it triggering both. I guess i will scrap it and try to go about it a different way. Thanks for the help!

I seem to recall them triggering pretty erratically. Honestly, just give the other nodes a go :wink:

I remember the problem now. You have to wait for the timeline to finish before resetting those DoOnce nodes, it’s a pain in the but.

I know this is old, but I ran into this recently. I was able to fix it by using a Gate node and closing it on overlap begin and not opening it until the overlap begin function completed.

1 Like

Could be a million differences between the 2 situations.
Generally speaking you want to avoid moving trigger boxes / collision areas at runtime.

Say the platform was movable and raised along with the character when it entered.
If the trigger moves along with the platform its almost a guarantee you’ll get issues.
If the trigger is outside of it, and thefore cant move with it, then the collision won’t necessarily change.

Second, and perhaps more importantly. The code shown above is situational and probably incorrect (evident by it not working?)

Unless you want to track all actors entering a volume, you want each actor to react in its own blueprint to the teigger in whichever way it should (The character can tell collision/overlaps just as much as the volume).

If you really want to track actors and all that.
On begin overlap > check if actor is already overlapped or not (by placing them in an array and testing for it) > if not overlapped add to array > proceed with your code.

On end overlap > check if actor was in the overlapped actors > remove the actor > proceed with your code.

1 Like

While I agree with almost everything you said, sometimes component overlaps randomly trigger functionally at the same time and a variable value or array value will simultaneously return true and false in the same frame (or null/object). That is why I had to use the gate. It is basically a shorthand for a redundant do once with an additional local bool. Why it works though when setting a variable and checking it yourself doesn’t sometimes is the local bool triggers and checks before the other values so it locks it properly. But in a normal situation just setting a variable yourself is better and more performant.

1 Like

Thank you! Yes, that’s exactly what it was in my situation. The box collision was a child of a static mesh component which was moving via a timeline. This setup caused both OnComponentBeginOverlap and OnComponentEndOverlap to fire at the same time (even though the overlapping Actor had not exited the box and was still valid).

I found 2 solutions:

  1. Make the box collision a child of the non-moving Root Component so the box does NOT move at all. Unfortunately, since the trigger box was for an elevator, it meant it now had to be extended in Z to match the elevator’s full travel depth, but definitely works. :grinning:

  2. Make the box collision a child of a moving component that does NOT move immediately upon overlap. In my case, I had a 3-part pressure plate, where the Top plate moves immediately, then the Mid plate, then the Base plate (and all higher plates are children of the Base plate). So if I make the box collision a child of the Mid or Base plates (since they don’t move immediately), there is no problem. :grinning:

Interestingly, even if none of the above solutions are followed, and both Begin and End Overlap events fire at the same time, the Begin Overlap event seems to be given precedence and the Timeline will still play forward (unless you are running any checks before the Timeline plays, such as IsReversing?. In that case, the checks cause enough of a delay that firing both Begin and End simultaneously might cause problems, such as the Timeline trying to play both Forward and in Reverse, resulting in no motion at all. I found this glitchy behavior manifested **ONLY** when my character entered the collision box **VERY slowly** rather than quickly walking in or jumping in).

Can you guys elaborate / provide steps which cause both events to trigger - along with the engine version?

They really should not unless the object is aactually outside the overlap.

Lets try to drill down into it to see if its an engine bug that needs fixing or not…

1 Like