Download

Why does my door stop opening when I stop moving?

Greetings! It’s been a number of years since developing with Unreal Engine, so I’m coming back and having to relearn a few things. But I’m having a problem that I don’t feel like I should be having. I’m just making a simple swinging door. But the problem I have is this: When I’m walking up to the door and it starts to open, I’ll stop to let it finish, but when I stop, the door “stops” (Actually, shakes in place) and if I move forward it starts opening a little, and if I walk backwards, it starts closing a little. I feel like my doors are fans of SUPER HOT…

I’ve got the exact script that is in one of the Unreal Docs. When I have the script up and play it, I see that when I hit the collision box, the Begin Overlap fires like it should, but when I stop moving, then suddenly both the Begin Overlap and End Overlap fire so my Door Timeline is in a perpetual Forward then Reverse loop.

I’ve already made sure that my mesh “Visibility Based Anim Tick Option” is set to “Always Tick Pose and Refresh Bones” as I’ve seen as a solution for this while searching for other people having this problem, but it doesn’t fix this.

I’ve also tried making additional logic in the BP to block the End Overlap signal if the Begin Overlap was active, but this didn’t work. Also, I noticed that no matter what direction the door was going, the “Direction” enum is always Forward. (I turned on the Watch for this.)

So now I’m stumped. This should be simple and straightforward. Why am I having this problem?

Any thoughts on this? To recap the BP: In the most basic form, I have the two Overlaps running into the Door Timeline in their respective Play/Reverse posts. Then the Time data gets fed into a Rotator (Z axis), and then the flowpath from the Timeline and the data from the rotator feed into the SetRelativeRotation function, taking the door mesh as it’s Target.

Simple, right?

-Marc

This works exactly how you expect it to:

1 Like

Yes! I can see this working much better. I will probably need to make a few modifications to include AI characters, but that won’t be a problem. Thank you! Still wish I knew why the other didn’t work, especially seeing it in the official docs. But whatever. After fighting with it, I’m over that! Lol! Again, I really appreciate this!

To save you some trouble: Get Overlapping Actors | Unreal Engine Documentation.

The one you were using has two triggers, so the triggers will basically fight each other. They also didn’t trigger at the appropriate times, which could cause them both to fire at the same time.
My graph has only one trigger (the tick) and simply checks the state of the box. It literally translates to “if the player is inside the box, open the door; else, close the door.”

See, my problem is that the first trigger should start when you (or any entity) walks into the box, then knows that you’re there. The second one shouldn’t trigger until you leave the box. But the second trigger fires simply if you stop. In my viewpoint right now, this is a bug. But the solution given is a more straightforward way of looking at it, and I like it. Going to have to test it when I get back to my project later and run the debug on it just to see how it performs. In my scrambled brain at the moment, it seems like it’ll be constantly running the Reverse the entire time unless you’re in the box which seems like a performance hit. But I could be wrong. Can’t think completely straight at the moment due to last night’s beverages. Lol

So I just tested your original graph (never tested it originally)… it worked perfectly for me, lol.
Here’s the graph:


There’s a character check (which should work for both player & ai), but it even worked without it. Having the character check may solve your problem, but idk.

I tested the triggers using print string, and BeginOverlap only fired when I was in the box, and EndOverlap only fired when I exited. So idk why yours doesn’t do the same. I’m on version 4.20 and used the default third person character.

I think I had a similar problem. The ‘On Begin Overlap’ and ‘On End Overlap’ events were being fired simultaneously which led to the door opening and closing at the same time (thus having the shaking effect).
The problem for me was, I had attached the trigger box on the door mesh, So it would also rotate with the door
When the player first triggered the ‘On Begin Overlap’ Event, the door would open, rotating the trigger box along with it. Which would take the player out of the trigger box and thus firing the ‘On End Overlap’ Event which would close the door. Closing the door would again bring the player in the trigger box, thus opening the door again.
This cycle would continue forever as long as the player is standing in the spot.
I just had to make the trigger box a separate component instead of the door’s child and it worked.

Wow! I bet that’s exactly what is happening. I didn’t think I had attached it to the door, but I bet that’s what happened. Didn’t even think to check that. Had checked everything else but that. Thanks!

Just realized a problem with using triggers: whenever anything leaves, the end overlap trigger is fired and the door closes regardless of what else is in the box. This new graph fixes that problem: the door is allowed to open only if a character enters the box, and the door is allowed to close only if no characters are in the box:

This should fix the problem with your first graph.