How to get the input axis value in the AnimGraph?

Whilst following the animation tutorial in Simple Shooter. I had found it is very disappointing that it gone off to the joystick area and completely neglected keyboard user. As the tut from 184 to 186 implement things that make sense for joystick user but not keyboard user.

Currently I have an almost identical to the tut but the problem is that both W and S shown the value of 600. Or if I tried to link the Yaw to the Set Forward instead. I get 0 for W and -180 for S. You see how this is confusing? Although, A got -90 and D got 90 with the current setup, yet still I want it just to read the input axis value from Strifing. So techniqually Strifing work

Now onto my question. Such as, how can I get the axis value from the key the I pressed. For example if I pressed W how can I retrieve -1 which was assigned to it.

I had done some research but however I couldn’t find such function as shown in the screenshot below.

Screenshot 2022-02-23 215136

1 Like

Hello, to create an input binding like shown you need to go into your project settings and find the input section. In there there will be two kind of bindings: Axis and action bindings. This will be an axis binding. You call your binding “MoveForward” (or whatever you want) and setup the input for w to equal 1, s equals -1. The same goes for your other bindings. Then this function will be automatically created for your Pawn / Character Blueprint.

Thanks for your answer but that not what I am asking. I am talking about the animation blueprint which is different to the blueprint you mentioned.

Like how do I get the animation graph to read those values I circled in yellow in the screenshot .

I tried to take a screenshot for when I searched for the function but whenever I tried to used my screen capture software (Windows 10 thing) it disappeared so you have to take my word for the following.

When I searched using the term “inputaxis”

I got 3 results:

  • Break InputAxisKeyMapping
  • Make InputAxisKeyMapping
  • Set members in InputAxisKeyMapping
    Which they ain’t what I am looking for no do what I wanted

I also tried separating the word input and axis and they return nothing I am looking for.

I hope this clear things up a bit. If not I might have to do a video recording but hopefully I don’t need to.

P.S. If my OP was a bit confusing then
Screenshot 2022-02-23 215136
This one was taken from Input Action And Axis Mappings In UE4 - Unreal Engine Which as I mentioned I could not find (InputAxis [Name that I used]) in the animation blueprint.


This is the animation graph blueprint not the character blueprint. I should had taken the full screen but I assumed you could tell the difference.

You shouldn’t need to do anything special for keyboard input. If you want something like shift to walk then you can add an action mapping that sets the max speed to the walking speed.

Yes I am trying to work with the blend space animation tutorial whilst the tutorial seems to gear toward joystick uses I am trying to find way to make it work for the keyboard as well.

Like my backward animation seems to be a cross between the jog_left and jog_back animation instead. And that’s what I am trying to fix and it seems whatever was in the tutorial is not helping.

Like I had attached debug node as in the SS and the results shown as when pressed
W = 600
S = 600
See how is strange that both going forward and backward is a positive number
A ~ -90
D ~ 90
Still like I trying to figure out how to get the float value from the keybind axis (i.e. 1 or -1) so I am not dealing with obscure numbers like these.

In what manner? As I said it already works with keyboard; provided that you use a modifier key like shift to change from walking to running.

Keyboard is a digital input, it’s either on or off. Can you name a game that has behaviour that you’re after?

Its ok. Just some animation looks weird.

Do you mean going diagonally forward/left or backwards/right? e.g.

That’s an issue with the skeleton/animation. Not much we can do about that.

Any variables you want your animation blueprint to have access to should be stored on your character. Then make a single function on the character that returns animation critical values. In the animation blueprint get a reference to your character and call the function to get all values at once, then use those for the animations. Some of my relevant code is below, it’s C++, but there are equivalent blueprint nodes for pretty much everything I’ve done here. Here is how I process movement input and pass variables to my ABP…

image

image

image

image

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms