Activate button with key


I am trying to activate the animation from a mesh during gameplay with keyboard button (Interact = “E”), when the player is inside the trigger box (checked by blueprint).
I am trying for some time now to be able to press the key and activate the blueprint without succes.

Can anyone help me with what I am doing wrong?

If I call the blueprint with another one it’s working. The problem is that this blueprint is not working by it’s own.

Thanks a lot!

Did you enable input on the button?

Thank you for your answer.

This was the problem! Wow, didn’t expect something so hidden in the menus just for this simple problem. I will keep it in mind for the next buttons :slight_smile:

I think you will find the button can be activated from any distance…

In my scene I have more buttons like this (see picture attached)

After doing what you mentioned (in button B blueprint), seems like the other buttons in scene are deactivated. How can I enable this to work independently for all the buttons?

I am trying now to get the line trace approach, as you are mentioning is good.

The problem with line trace is that I can’t activate the function called in player event graph. See picture attached.

Thank you for trying to help me. It looks like a simple problem but it’s getting me headaches… :slight_smile:

I have a condition in blueprint to work only when I am inside the trigger box.
And it’s working fine but I found another problem: (see below)

The problem is, you’re not specifically sending the E event to the actor in question, you’re calling it globally.

The classic way to approach this problem is with line trace and blueprint interfaces. It will take a while to get sorted out, but once you have it, all the rest of your interactions will be trivial.

Do you need more info?

It basically looks ok, but in the button BP replace the interact event with a plain custom event which you call from the trace.

You’re already starting to see why people use BP interface, it’s to avoid all this casting!

If you have several hundred objects that can be interacted with, you can see this is not the way to go.

Once you have to BPI setup, you can just say to any actor ‘you have been clicked’. It’s then up to the actor to respond, if at all.

EDIT: Sorry, you did do that first part. What happens when you call the custom event in the button? Is the cast succeding?

If all you changed is the name of the node, then the cast is failing.

When I call the custom event, nothing happens. I don’t know if I am missing something in one of the BP.

After looking in depth at the problem I found what was the couse of it.

It was something related to the collision boxes around. There was another object collision box in front of the collision box of the button that was causing the linetrace not to hit the button.
After I managed to discover this and fix it, it’s working how it supposed. See picture attached after fix. It’s good to know for future.

Thank you for helping me out!
I’ll have other questions, but I will post them in another thread.

Cool 8) …