Announcement

Collapse
No announcement yet.

Keybindings in Blueprint, without Plugins

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [TUTORIAL] Keybindings in Blueprint, without Plugins

    I found a very simple solution for Keybindings, without the need of a Plugin. (I know that there is such a plugin, but i did not want to use it.)

    It might not be the fanciest solution possible, but it is easy to use and compatible with every Version of UE4 that has the Nodes that i used in Blueprint. (Plugins can be troublesome if you switch engine versions and the plugin gets outdated.)


    What you need:
    - 1 Variable (Key) for every Key you want to rebind [WASD and SPACE in this Example]
    - Events that trigger the Movement-Input

    Then you do this:
    Click image for larger version

Name:	UE4_Keybindings_1.PNG
Views:	1
Size:	425.1 KB
ID:	1216752


    and this:
    Click image for larger version

Name:	UE4_Keybindings_2.PNG
Views:	1
Size:	109.5 KB
ID:	1216755


    Done!
    You can now rebind your Key-Variables from anywhere.

    It can easily be enhanced for 6 DOF or anything else. (I am using it for 6DOF and normal FPS-Controls in the same game, without any problems)

    #2
    Thanks to share [MENTION=36408]Yaeko[/MENTION]

    I was just wondering, he supports controller/gamepad?
    I means, not keybind the gamepad input, only keybind the keyboard, but if I plug a gamepad I will be able to move my character around.

    And again, thanks to share.

    Comment


      #3
      Originally posted by Rgiz View Post
      Thanks to share [MENTION=36408]Yaeko[/MENTION]

      I was just wondering, he supports controller/gamepad?
      I means, not keybind the gamepad input, only keybind the keyboard, but if I plug a gamepad I will be able to move my character around.

      And again, thanks to share.
      I can not test it, since i do not own a controller.

      BUT i think it should work... i do not see any reason why it should not work (you just need to plug in your controller-values into the event // alter my approach a bit).

      Comment


        #4
        I did! Its not pretty, its ugly, but works xD
        I tested with a PS4 controller using the DS4Windows to emulate a Xbox controller, but probably works with a Xbox controller
        BP below, now need just ad a umg to change/save/load the variables "Key ..."

        If anyone know how improve this, please share

        Thanks [MENTION=36408]Yaeko[/MENTION] o/


        Click image for larger version

Name:	143be7cda93efe4e21a1e88241cc56c7.png
Views:	1
Size:	248.5 KB
ID:	1126797

        Comment


          #5
          Originally posted by Rgiz View Post
          I did! Its not pretty, its ugly, but works xD

          If anyone know how improve this, please share
          This is exactly what i had in mind when i answered to you.

          I also do not see many room for improvements, since this is already the most minimalistic and easiest way to achieve Keybinding that I have seen.
          It is a bit "dirty", but who cares, if it works... it aint stupid. :P.

          Thanks @Yaeko o/
          No problem, took me whole night to find this workaround, decided to share it with everyone because this is a common question for Blueprint-Only games.

          Can we get this into the wiki - at least until Epic decides to put in actual support for keybindings in Blueprint?
          Last edited by Yaeko; 04-23-2017, 03:48 PM.

          Comment


            #6
            Managing Plugin versions is a total PITA, so its nice to see some independent minded spirit!
            I wonder if it could be expanded to be more generic and offer more controller options etc???

            Link every possible key / gamepad option in player-controller / invoke Gamemode custom events.
            From there have generic key / button traps that call generic Dispatchers or an approach like that...

            Might also need to implement game-instance to store the in-game bindings between level loads...

            Comment


              #7
              I wonder if it could be expanded to be more generic and offer more controller options etc???
              You can feed everything into the System that you can press, regardless of the type of input. (even VR should work, but would not make much sense)

              Link every possible key / gamepad option in player-controller / invoke Gamemode custom events.
              From there have generic key / button traps that call generic Dispatchers or an approach like that...
              I only provided the basic idea, since everyone has different needs.
              If you need more functions, you can easily add them, but i will not add them here... just to keep it simple enough that even newbies can replicate it.

              Might also need to implement game-instance to store the in-game bindings between level loads...
              just store them in some actor that will never be destroyed, easiest way. (or simply do not destroy your pawn >.<... i just move them to where they need to be after loading.)

              Comment


                #8
                Hi Yaeko,

                Awesome Tutorial. I'm interested in your take on implementing Co-piloting Keybinding? We have a discussion going on about it over here. But, in a nutshell, the copiloting allows two players to share the same character controller, with bindings to separate keyboards/mouse/gamepads.

                I personally can see the control scheme being useful in many game genres, especially Horror Games and controlling larges ships/crafts/giant robots. Ultimately, I think its a quick way to get a local coop multiplayer experience operational with nearly no effort, allowing two or more players control a single character.
                GOD of DREAMs: A Unique FTPS/RPG Sandbox MMO

                Comment


                  #9
                  Originally posted by TechLord View Post
                  Hi Yaeko,

                  Awesome Tutorial. I'm interested in your take on implementing Co-piloting Keybinding? We have a discussion going on about it over here. But, in a nutshell, the copiloting allows two players to share the same character controller, with bindings to separate keyboards/mouse/gamepads.

                  I personally can see the control scheme being useful in many game genres, especially Horror Games and controlling larges ships/crafts/giant robots. Ultimately, I think its a quick way to get a local coop multiplayer experience operational with nearly no effort, allowing two or more players control a single character.
                  Wouldn't it be the easiest way to just "Cast" to the pawn they control? (My Keybindings/inputs can be casted, if done right.)

                  But maybe this needs a hidden "pawn" that can fire these events to the pawn they actually control.

                  Should be possible, but i have never tried stuff like this.

                  Comment

                  Working...
                  X