Download

Disable certain Key/Axis Mapping programmatically

Hi,

I am not aware of such feature if it already exist - so I am requesting a feature as stated in the subject. The reason is because in our cases (and I believe in many other projects too), such BP axis node should not be executed at all in certain times , eg when we are in inventory mode, we should not check for movement axis node. This node can be quite lengthy and the overhead can be a lot.

There functions to ignore input that are already exposed to the Blueprint system:

  • SetIgnoreMoveInput
  • ResetIgnoreMoveInput
  • IsMoveInputIgnored
  • SetIgnoreLookInput
  • ResetIgnoreLookInput
  • IsLookInputIgnored
  • SetCinematicMode

You can also use “SetInputMode” to force it to UI only.

You may need to use FlushPressedKeys(), but I don’t think that is exposed by default.
You may need Rama’s Blueprint library (I think it has it).

Hi @Kris,

Related question:
Is there an easy to import Inputs at runtime or to cache multiple Inputs and switch between them using BP?

Actually what I am looking for is something like
IgnoreAxisMapping(“BeginSpeaking”) or DisableAxisMapping(“BeginSpeaking”)
and
UnignoreAxisMapping or EnableAxisMappung.
and the mapping string is what is entered in the Input settings.

I have taken look at Rama’s… I think it simply remove and add - which may be sufficient but I haven’t taken a look at Add of which the parameters should match exactly the old ones.

@franktech Not exactly sure what you mean by “import Inputs at runtime”.
Its easy enough to redirect / override existing inputs via a well placed Enable/Disable Input node.
The only immediate issue in doing this is that the input is not replicated to the server.

@Syed The same thing could be used to ignore/stop ignoring a particular input too.
To ignore the action, enable input for the local player controller and consume then a the input you want to ignore.
When done, disable input for the local player controller.

I actually created something similar to what you describe - Listen for Input Action & Stop Listening for Input Action.
I might be able to change that to be compatible with a Blueprint function library… in which case, it could be added to Rama’s function library.
If you (or anyone else for that matter) are interested, let me know and I’ll see about getting it converted and add a pull request to Rama’s function library.

Project Settings → Engine → Input → Bindings → Action / Axis Mappings → Import button…

The editor offers an easy Import / Export option via INI to switch Keyboard / Mouse Input settings…
Handy when you have multiple characters each with their own inputs spawned from spaceships etc.
I was asking if Inputs could be set using this Import tool at runtime without manual rebind in code?

Ahh, alternate configs/profiles.
No, there is no native way to do this that I know of.

You could just create different actions defined in one player controller, with each of these actions pointing at a different kinda of character/pawn if and when you were controlled said character/pawn.
e.g Infantry/Wheel Vehicle/Flying Vehicle