Alternatives to a branch for disabling input?

I want to only allow the player to look around if he is not pressing the key V. Or in other words, pressing V prevents camera movement. I have this system that uses a branch, but the event in which the player presses V is something that happens rarely. I don’t want to be checking that branch every time the player moves the mouse. Is there a way to deactivate this input if V is pressed, so that I don’t have to check the branch every time the button is pressed?

You can use a Gate node and close / open it with a custom event :blush:

However I wanna add that there would absolutely be no difference in performance either way.

You could do it for the entire mapping context but not for specific input actions.

Yes but I still need extra checks. Since the player will always turn the camera around we would be chcking the gate (or the branch) at tick.

The player should disable this input only at very specific ocasions in which he would press V.

Is there no way to just disable it if another input is active (V) ?

Changing the input mapping context seems like a possibility?

Not optimal in this case, there’s nothing wrong with your current setup. Like I said, you could use a gate if you want to make it neater.

Why not optimal? The changing of the mapping would only happen at certain specific occasions.

On the other hand, we would not be checking the branch or gate at tick.

So why do you think that changing the mapping context is less optimal?

I can assure you that it’s not a heavy load at all to constantly check many conditions every tick. Your desire to make your code more optimal is really admirable, but switching mapping contexes solely for this purpose would be going way out of the way.

What you’re currently doing is not a bad practice, it’s something everyone does because it’s the best way for this specific task.