You can get the velocity of your character if it has physics or is using a MovementComponent.
Then, in your Level Blueprint, for example, you could get the velocity and check to see if it is moving or not, and react accordingly.
i don’t know if this solution would work so well. if the player stands in the trigger for too long, the OtherActor reference might get garbage collected, and you would get an AccessedNone error. or if the player stands in the trigger, then another player runs through the trigger, and leaves the trigger, triggerHit will be false, even though there is still a player standing in it.
to avoid these reference variables going out of scope, and to avoid the state of the door going out of sync with reality, it would be better to use GetOverlappingActors, and use a forEachLoop to see if any of the pawns on the list are standing still. but that would be wasteful, because you would have every door iterating over lists of objects every tick.
instead of the door ticking, it would be better to have the pawn keep track of which triggers it most recently collided with, and when its velocity is low enough, it can call an event on that trigger. inside that event, the trigger could use IsOverlappingActor, to check if the pawn who sent the event is still being overlapped.
onActorEndOverlap, the trigger can GetOverlappingActors, then get the length of that array. if the length is 0 and the door is open, close the door.
From my experience thus far, triggers are meant to be activated right when you hit them. They trigger an event.
Because this isn’t exactly how it’s being used, I propose the triggers activate/set a variable which is then used elsewhere.
This solution is pretty much all done in your character’s blueprint.
We use the triggers to toggle booleans and save the trigger we hit.
The cast will only be true if the overlap is with a trigger volume.
We get overlap events and our input events. To check if we are stopped without a tick, we will simply check to see if we are sending any movement input. If we aren’t, and we have overlapped a trigger, it checks to see which trigger we have overlapped, and does the corresponding task.
You will have to name your trigger volumes, but this way seems to me to be rather clean and easy for what you want to do. You can add and take away all the triggers you want.
you´re not supposed to be able to walk when simulating, because the pawn is detached from the player controller.
You might want to hit play in viewport or other options.
On overlap with the trigger, play a looping Timeline that checks for velocity 0 on the Update exec. (To make a looping Timeline, right click, type it in, scroll down and find the thing to add a new one, double click it once it appears, and check the loop checkbox at the top of the Timeline editor)
If it’s false, do nothing. If it’s true, send an event to stop the timeline and then do your thang.
On end overlap, send an event to stop the timeline.
This is, as far as I can think of, the most simple way to achieve this. Looping timelines are not process intensive, and ending the loop on end overlap prevents it from being any kind of perpetual process.
Let me know if you’d like a picture and I’ll whip it up.
Let me know if you have any questions about this setup. To get into the Timeline editor, double click the Timeline node. That’s where you can find the loop checkbox
Also, in case you aren’t familiar with Timelines, they fire off the Update exec pin constantly, until the Timeline has either stopped or finished (if you set it to a limited amount of seconds). It can also output values based on graphs you create within the Timeline editor.
You should never, ever use Tick unless you are testing something or printing string values. Timelines are ya boy.
Your setup is cool, i understand it except the part where you are checking for the player.
Plus, this part doesn’t seem to work. With print string i checked where the events stop to work and it didn’t pass the first branch lol. So that’s why i don’t understand the part where you get the class etc. It is where it blocks