When player walking => trigger ignore

Hi,

My project is based on the First Person Camera

What I am trying to do is :

When I walk in a trigger box placed in front of a door, the door don’t play the rotation. Then if I stop in this trigger, the door play the rotation

I want to use : Move Component To if possible

How does your blueprint look like at the moment?

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.

It’s not multiplayer. It is for an Architecture Vizualisation so there is only one player. I’m gonna try what you both said ! Thanks for replies!

Ah, it works but for only one door (Event Tick is not correct to work with multiple object that have different rotation or movement etc.)

Do you have another solution ?

@Omnicypher : I’m not sure if i understand your solution for the ticking event

There is the first setup for the first door with the solution of @Maverinox

But I also have an other door and i can’t use Event Tick, i would like a solution to combine :slight_smile:

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.

@Marverinox : I can’t move when i simulate! xD

I can’t walk maybe because these Events are also used in the Character Blueprint to set the walking

you can call the input events more then once haha.

have one event add movement input, then maybe have one for this?

It works for me xD I’m not sure what to say otherwise unless I see it.

There is my current blueprint. And i can’t walk when i simulate… I really don’t know why lol

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.

I can’t walk too when I hit play in the viewport
When I delete the inputs axis events, i can walk… I don’t understand why it doesn’t work

Alright… When I walk it well displays the string node “Walk” BUT, i can’t move, my character stays static

Why…?

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.

I’d like a picture if possible! I just start UE4 since a few weeks

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

Make sure the class you’re using in the class check is the same as your player

The reason you’re checking for the player is so that it doesn’t trigger if something else overlaps it