Input Axis in UE4

Unreal Engine 4 has some awesome features and a whole bunch of stuff that makes life really easy. Lots of these are small, minor things that people often don’t pick up on, or can be hidden away a little, and the Unreal Engine blog is doing a great job of explaining some of these things.

One thing I’ve found is that often the posts don’t go quite far enough in showing an example of how to use something, which is the goal of this post, and hopefully more into the future.

This concerns the Input Axis feature, which is well explained in this blog post from Epic
But how can these input axis bindings get put to use?
It’s actually quite simple!

In this example, I’m working on a Shoot Em’ Up prototype purely in Blueprint

Shoot 'Em Up prototype in UE4

Shoot ‘Em Up prototype in UE4

I’ve added a couple of simple InpuxAxis bindings as described in the Unreal Engine post.
If what you want to control is based off Character, then by default it has a CharacterMovementComponent which you can see in the Components tab.


CharacterMovementComponent in the Blueprint Components tab

If you have this, then there’s a very handy way to move your Character in Blueprint – the AddMovementInput node.


AddMovementInput node

This accepts a Direction and a Scale Value. In the case of the Shoot Em Up. The Direction is simply the direction you want to move the Character in, and the ScaleValue is the scale that you get from the InputAxis.


Using an InputAxis event

As you can see here, I’m using Horizontal Axis and moving it along X.

If you’ve already got a setup and don’t want to use the InputAxis events, you can also get the axis values as variables


Using an InputAxis variable

That’s all for this post!

Leave a Reply