Announcement

Collapse
No announcement yet.

Get "Key" struct from input event

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

    Get "Key" struct from input event

    Like usual, I feel like I'm probably just overlooking something, but I can't seem to find a way to get a Key struct reference from an input event. Is there a way to do this, or it just not exposed to Blueprint by default?

    Side note: yes, I know I have both key events plugged into the GetKey node. That's just for the screenshot.

    Click image for larger version

Name:	MUrgDHg.jpg
Views:	1
Size:	66.0 KB
ID:	1145319
    @thereisnoscotty
    Grand Marshal of the Parade of Madfellows

    #2
    What this method wants to have is a Input Event as a param.

    You can use GetKey when you override the Input Functions OnKeyDown a.s.o.

    These will give you the event struct and out of this you can call get key.

    What do you want to achieve when you already know the key which is pressed?
    Have you unchecked Context Sensitive to get that Method? just curious.


    Edit:
    If you want to use this this way, you could add a variable which is a Key Event (i believe it was called like that) and set it in a overriden OnKeyDown.
    In your event you can now get this Key Event and call Get Key out of it.

    its a strange way though
    Last edited by Wallhalla; 03-07-2015, 04:40 AM.
    Live long and prosper.

    Comment


      #3
      Ideally, I'd like to expose the Key struct from an input event like Delta is exposed on Tick. The goal is a reusable function that isn't affected by remapping keybinds.

      The workaround I developed with some help from one of the Facebook groups employs Tick and the Input Action to open and close a gate if the Input Key is held, but that fires the entire logic chain every frame, which isn't exactly an ideal scenario.

      It's starting to look like I'd have to mod source code to do this, and that's where I start getting nervous.
      @thereisnoscotty
      Grand Marshal of the Parade of Madfellows

      Comment


        #4
        Originally posted by Wallhalla View Post
        What this method wants to have is a Input Event as a param.

        You can use GetKey when you override the Input Functions OnKeyDown a.s.o.

        These will give you the event struct and out of this you can call get key.

        What do you want to achieve when you already know the key which is pressed?
        Have you unchecked Context Sensitive to get that Method? just curious.


        Edit:
        If you want to use this this way, you could add a variable which is a Key Event (i believe it was called like that) and set it in a overriden OnKeyDown.
        In your event you can now get this Key Event and call Get Key out of it.

        its a strange way though
        Yeah, I unchecked context. The problem is the event not sharing which key was pressed to fire the InputAction, not nodes being hidden by context.

        I know what's being pressed by default, but the end goal is to allow remapping, which requires a function that isn't depending on hard-coded keys.
        @thereisnoscotty
        Grand Marshal of the Parade of Madfellows

        Comment


          #5
          Still digging around on this. I found the option to Add Call to Parent Function on the Tick node, but can't seem to do that on InputAction mappings, or even direct InputButton nodes. Google is telling me "Oh yeah, you can totally just call to parent function," but that doesn't seem to be the case for input.

          Click image for larger version

Name:	attemptedoverride.jpg
Views:	1
Size:	101.5 KB
ID:	1067907
          @thereisnoscotty
          Grand Marshal of the Parade of Madfellows

          Comment


            #6
            Well, since HeldTime has to be constantly updated, the dependence on Tick isn't going away. Since Tick can only exist once in a graph, though, the need for access to the InputKeyEvent struct has become quite a pressing one. If anybody knows how I might go about exposing that struct reference on a custom InputAction node, we could be buds for life.

            Current iteration, featuring some of Rama's awesomeness:
            Click image for larger version

Name:	snap070.png
Views:	1
Size:	129.2 KB
ID:	1067919
            @thereisnoscotty
            Grand Marshal of the Parade of Madfellows

            Comment

            Working...
            X