Default Input Mapping - Where the hell is it?

Hi! So, I’m fairly experienced in UE4, but there area few issues I just can’t seem to find answers for. One of them is where all the “hidden” input mappings are. Meaning…I can create a new empty project, hit play, and fly around the default map using WASD keys. But if I go in to the project settings for input mappings, it’s empty.

SO…is the default PlayerController listening for raw keys? (i.e., events for the key presses, instead of binding in the input manager?) Is it really the PlayerController, or is it a movementComponent in the PlayerController?

More importantly…lets say I want to turn off all this default input mapping, how do I do it? Right now, I can easily bind something else to the WASD keys, but I can’t seem to UN-bind the current default player controller functionality.

I guess if I can’t turn it off, it would be at least a step in the right direction to at least know what UObjects or components are going to grab unfiltered input…is there a list of those input keys somewhere? (I know I can go to the source .cpp files and start searching but I’m hoping there is an easier way…)

Epic Launcher contains multiple starter project. Each one is different and I’m not familiar with the specific one you’re talking about, but:

  • Input mapping from keys to action is defined in project settings. I’ve played with various starter projects and they all have default values even if not be used. Make sure it really is empty
  • Regardless of binding, the usage of those actions isn’t automatic; that is, if you can fly around there is something in the project that’ detecting an input either through key or action, and moving the player.
  • The actual actions is usually done in the player controller. I’d suggest you find the PlayerController used by the specific level you’re talking about, and look how it handles input (keys vs actions).

p.s.
The only way I can think of you being able to fly around with keys without any bindings/input handling is in the editor it self, and not in play mode. That is, when “flying” through the scene. So make sure you’re in play mode as well.

Look at DefaultPawn, DefaultSpectatorPawn, and their associated movement components.

thanks, hyperdr1ve. Looks like all the bindings are in the DefaultPawn.cpp file. There also appears to be a boolean flag to turn them off, which is nice. I was assuming the mapping would be somewhere in the playercontroller class, and wasn’t finding it.

I think it would be nice to have a page in the official documentation somewhere that just lists everywhere there is a hard-coded key binding in any of the built in classes…but I guess its not too terrible to do a mass search in visual studio.

For anyone else looking in to this…Looks like the following lines are what is causing my issue, so all I really need to do is make my own pawn class instead of sticking with the defaultpawn.


void InitializeDefaultPawnInputBindings()
{
    static bool bBindingsAdded = false;
    if (!bBindingsAdded)
    {
        bBindingsAdded = true;

        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveForward", EKeys::W, 1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveForward", EKeys::S, -1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveForward", EKeys::Up, 1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveForward", EKeys::Down, -1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveForward", EKeys::Gamepad_LeftY, 1.f));

        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveRight", EKeys::A, -1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveRight", EKeys::D, 1.f));
        UPlayerInput::AddEngineDefinedAxisMapping(FInputAxisKeyMapping("DefaultPawn_MoveRight", EKeys::Gamepad_LeftX, 1.f));

Anybody know how AddEngineDefinedAxisMapping differs from AddAxisMapping? The help page is not helpful. Is there by any chance a global flag somewhere to disable EngineDefined mappings?

Yeah the DefaultPawn isn’t really something you’re meant to inherit from - it’s just there as a backup for the engine. Typically any pawn you create will subclass from APawn.

Setting up input bindings for a class is done in the (virtual) SetupPlayerInputComponent() function. From there you add bindings to the input component and the engine handles removing that input from the input stack when you possess/unpossess the pawn accordingly.

The mappings themselves you et in the project settings and don’t modify at runtime.