Download

Trigger doesn't recognize keypress

Hi all,
I’m trying to animate a door to open when my charcater presses F
I have created a blueprint actor, a door is set as the static mesh and a trigger box is also added.

In the Character’s BP, I have created variable to see if the “F” key is pressed or not:
b164d5f232a8c87c5bb1f2a17cee681eaa5470fc.png

in the Door’s BP I have created the following:
ab14dff4b591f4b9976d715c86ba5c38f0f5e99b.png

As soon as I walk inside the trigger area, I do get the “F is not hit” print.

But when I do press F, I don’t get the “F is hit” print.

What am I doing wrong here?

Thanks

Hi pedrampedr!

Just a quick sanity check: with that setup, you would have to press and hold F *before *stepping into the trigger area, then walk into the area while still holding F down in order to get the True result. Did you try that?

Hi Xenome,

I’m not sure if there is something wrong with the forum, but I tried a million times to reply to your post, but it doesn’t show it.

You’re right, it works when I HOLD F, but how do I get it work so that it functions after I enter the trigger box and press F?

Th

–Ninjad

fe415b7cf7962b8355a67989d80916684203cf1a.png

That should accomplish what you’re looking for

Thank you very much, that work! But WHY does it work?! What does the gate do?!
I have a lot to learn.

Thank you so much for the help

The gate works like a coded door, it’s closed by default so the exec pin cant pass through it, when you overlap the box it opens the gate so you can pass through it, and when you leave the box it closes the gate again stopping the flow.

A full rundown of what’s happening

– On tick the code casts to your player and checks if F if pressed or not, that passes to a branch, if F is pressed if checks the local variable “FPressed” to see if that’s true or false, this prevents a constant stream of checks on tick, if that’s true if does nothing, but if it’s false it runs to a sequence which executes code in order, firstly it passes through the gate and executes that code if you’re within the overlap bounds, then it sets the “FPressed” variable to true, this stops the BP from executing more code on that specific key press.

Thank you very much for the help!