Disable Specific InputAction

Hello, i’m trying to disable a certain input (like Right Mouse) when i enter in a trigger box. I know there are already some answered questions on this topic but i don’t understand them. I wish Epic would’ve made a switch for this :). Can someone provide me with a simple blueprint, preferable a picture?

what you can more easily do, is to set a boolean to true when you enter the trigger box, and add a branch on you right click event with that boolean, it will block the input.

Hi there,
this is probably the cheapest solution:

Your custom switch for the input (set StartClosed to false) :

Trigger:

hth :slight_smile: Marooney

And just in case you have to deal with multiple overlaps where a single EndOverlap would enable input even if other triggers are still colliding:

(with an Integer… of course…) Unless you run into situations where collision events get lost for some reason, the counter should be fine.

Hi, thanks for the reply! Unfortunately it doesn’t seem to work. Maybe there’s something wrong with the location i placed them in. Could you have a look on these?

Does your character spawn within the trigger volume? Because then the BeginOverlap does not execute, but still the EndOverlap :confused:
I just tested it to make sure this issue still exists.
Just Print out the counter to check if it counts wrong (-1) due to this issue.
If your character always spawns within the trigger, then you can set the Gate to StartClosed and set the default value of the Counter to 1.

If you got different spawn situations then this Event driven solution might be too cheap and errorprone. The next solution would be to check every frame if the character still overlaps any triggerbox.

Thanks for the reply. Well… this is the type of answer i was talking about, can you post a pic?

Well, actually, another solution. Seems less error-prone than the event driven solution I’ve mentioned before.

Especially if your character spawns within the trigger and therefor does not receive the BeginOverlap event.
Handles multiple overlaps as well.

hth :slight_smile: Marooney

This is what the Gate does. (internal bool)
(when you build your own Gate with the boolean and the branch, then you still have the issue with the events on Enter and Exiting the TriggerBox)

Well, the print doesn’t show on the screen that the Right Click Buton is pressed so i guees that’s good. But it still play the animation (aiming ddown the sight).
This happens when the character spawn inside the trigger box.

Just need to mention that, if someone wonders: The reason you usually want to use OverlapEvents instead of Lookups is the performance. Best practice, and benchmarked it for my own physics engine. But other than events the lookups are reliable and the performance does not really matter anyway if it does not pile up.

This is how it looks right now, inside the Character Blueprint. It still doesn’t work? Maybe because it plays an animation when it’s pressed?

Why do you have both “Right Mouse Button” and “InputAction Aim Down Sight”? Isn’t your InputAction Aim Down Sights already called by the Right Mouse Button?

And i think it would be better to remove the previous RightMouseButton and InputActionAimDownSights to avoid conflicts while testing :slight_smile:

Btw. your animation needs to be played where “RMB Pressed” is printed. I guess you handle the right mouse button somewhere else as well. And that of course confuses the whole situation.

Yep, good point!