Download

Creating player movement from scratch?

I am trying to create player movement from scratch instead of using the templates. However when I run it, it doesn’t work and I can’t move.

This is what I have done so far…

  1. In the ‘Project Settings’ under ‘Input’ I setup the W, A, S, D keys for movement.
  2. I have created a ‘Character’ blueprint, and a ‘Game Mode’ blueprint.
  3. In the ‘Game Mode’ blueprint under the ‘Defaults’ tab, I set the ‘Default Pawn Class’ to my character blueprint.
  4. In the ‘Character’ blueprint under the ‘Components’ tab, I created a camera, but I didn’t set a static mesh or anything as I don’t want one (I assume this shouldn’t keep my character from moving).
  5. In the ‘Character’ blueprint under the ‘Graph’ tab, I created very basic movement, using ‘InputAxis’ and ‘Add Movement Input’ corresponding to the input keys I created in step 1

I have spend hours on this, and I even brought up both the first person and 3rd person projects and compared all the settings on all the tabs of both the ‘Game Mode’ and ‘Character’ blueprints, and other then a few minor difference, the setups appear to be the same.

I am obviously missing something somewhere, I just don’t know where? Does anyone know what I am missing and can help me out?

Here is a screenshot I made.

Hi Dekieon,

From the image shown, it looks as though you aren’t feeding a forward vector into your vector, which, unless you only wish to move into one direction, will not work. You have to be able to access the negative values of each axis that you want to move in multiple directions. Depending on what you are trying to accomplish there are multiple ways to go about doing this:

  1. If you want to base player movement off of player rotation: Try getting the Rotation of your pawn and breaking the rotation, then make Rot for the Yaw only. Plug the return value into a get forward and get right vector and then plug those into their corresponding sections of the movement input nodes.

  2. If you want player movement to be based entirely off of input without camera rotation, try plugging a get forward and get right vector into their corresponding movement inputs. This should allow you to change the movement based on your input axis without worrying about which direction the camera is facing.

I added ‘Get Actor Forward Vector’ and ‘Get Actor Right Vector’ and wired them up the same as in the first person template and it nothing has changed. pressing W,A,S,D does nothing at all.

I highly recommend this tutorial series as it’s absolutely priceless for setting up the basic character movements, it can be a bit dry at times and requires a bit of skipping/pausing to follow quickly but I’ve followed it step by step for my projects and it always works.

These tutorial series don’t have much to do with character movement. They do to some extent, but that’s still about 3 videos out of 20.

If you’re interested in your own character movement, which is relatively extensive, I recommend looking at the CharacterMovement.cpp in the source code on Github. You’ll realize that it’s a very very extensive file. Epic put a lot of stuff there that would be painful to do by hand and even more painful to do in BP. Things like checking if near ledge, checking if on floor, checking hits and stuff like that. It’s a good starting point though, at least looking at the code

Hi Dekieon,

How do you have your axis mappings set up? Further what exactly is happening when you press the W,A,S,D buttons? Did you ensure to give A and S negative values as they are moving in the opposite direction of W, D?

I did have them mapped to WASD but have since remapped them to TFGH.
I may have one or more of these backwards, but regardless the mapping is as follows…

Left/Right Movement
F Scale -1
H Scale 1

Forward/Backward Movement
T Scale -1
G Scale 1

What happens when I click TFGH…nothing. The view just sits still.

The reason i remapped these was because with WASD nothing happened unless I clicked the mouse button once, then WASD would move me around, E and Q would raise and lower me, and the mouse would spin me. Since I didn’t setup the mouse or the E and Q keys, I was thinking that it was some sort of default movement that was moving the view, but not my actual character. I was correct about this because since I remapped the keys, the WASDQE and mouse still do what they did before once I click the mouse button once.

Have you tried setting up your controls on a Player Controller blueprint to move the Pawn? Also, have you enabled input?