This is my blueprint but doesn’t work.
How i do to make a condition to branch with a info come Connect
This is my blueprint but doesn’t work.
How i do to make a condition to branch with a info come Connect
Your first problem is here:
On Event ActorBeginOverlap you have the object you are overlapping with (Other Actor) but you disregard it and get the first BP_Gencho you find. Maybe you want to check if the Other Actor is of class BP_Gencho before calling the Connect Message. This is done by trying to cast is to the correct class:
Now usually interfaces are used when you can’t just cast to the correct class - when you need to respond to several different and unrelated classes. They allow you to call events/methods without needing to cast. This allows your code to be just this:
If you want the cast and you know that this wont take arbitrary type of actor, you can implement the Connect as a normal event in your BP_Gencho and remove the interface entirely.
Now your second problem is this:
You have nothing connected to the execution pin of the Connect event.
You should store this value in the character and use it in the above branch:
This should fix your most basic problems. If the Enhanced Input works - you should be able to get your desired result.
Thank you for that!
But I wanted it so that if I pressed the “E” button and it was outside the collision, it wouldn’t work; it would only work if the object was inside the collision. As it is, even outside the collision, it picks up the object.
You can “disconnect” and reset the bool when the overlap ends but I think in your case another approach is better.
You can check for collision when and only when the player hits the button:
In any case you have to decide how to filter the colliding objects as any time you hit the button you might have multiple objects that are inside the collider.
Thank you so much, it worked!