Creating an MMO-style controller IV: Character Movement

Continuing the development of our MMO-style controller. Contents and overview can be found in this post.

Time to make our character move! This section will focus on movement on the forward/backward axis, and the left/right strafing axis.

First things first: Deletions in the default blueprint!

If you open up the default MyCharacter (or ThirdPersonCharacter) and open up the Event Graph, you will see that it is already populated by various input controls. Make sure to delete everything inside the Movement Input and Mouse Input comment boxes. We wont be able to properly control the character and camera for now, but that will be quickly remedied.

We’re actually going to code our movement controls in MyPlayerController, so open that blueprint up to add the following functions.

Add Forward Input

Adding forward input is something that will be reused a few times in the PlayerController, this should be in its own function.

Add Forward Input function

Add Forward Input function

This function is quite simple: we take the axis value from the MoveForward axis, check if it is negative (moving backwards), then apply the correct movement to the pawn.

If we are moving backwards, we need to set the boolean MovingBackwards to true. This value needs to be set so that movement can be handled properly in other sections of MyPlayerController.

When we are moving backwards, the axis value is scaled by 0.25 (Backwards Speed), so reversing is much slower than moving forwards. I’ve made this a variable, rather than having a general number here. It will be used elsewhere in the event graph.

Reality Moment: Originally I had these functions written out in full, in multiple places in the MyPlayerController blueprint. Only after everything was completed and functioning how I wanted, did I come back and condense these down into functions.

Add Strafe Input

The next function to write is for handling input from the StrafeRight axis.


This is very similar to the Add Forward Input function.

This time we only check MovingBackwards, and apply the BackwardsSpeed scaling factor if it is true.

Putting It Together

To finally add these functions into the MyPlayerController blueprint:

Forward and Right input

Forward and Right input

Now we can move the character backwards and forwards, and strafe too! We can’t rotate yet, but that’s coming up next.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s