Download

help understanding basic movement as described in manual

I know I have said this before, I’m still having a little trouble as a former unity user, so I am studying the manual as much as I can. I read the part on Input several times and I still don’t understand the blueprint implementation: this is the image https://docs.unrealengine.com/latest/images/Programming/Gameplay/Framework/Input/MoveForward_Blueprint.jpg
I understand the InputAxis MoveForward and then the Add Movement Input, but I don’t understand why the green parts are there and MORE importantly I know I would be lost if and when I would need them in other scenarios. Can anyone dumb it down for me a bit? Thanks!
MoveForward_Blueprint.jpg

Okay, here’s what happens in that blueprint. I’ll embed the full image below, for easier reading.

You press the forward button or stick and activate your input event. The execution now follows the white execution wires. So the next thing that happens is the execution of the Add Movement Input node. This node takes some arguments. Sometimes the input arguments of a node are required, sometimes you can leave them empty to use a default value (or 0). In this case the three inputs that the node takes are:

  • Target: This is the thing that you want to move. In this case it is unwired, so it takes the default value (self), which is the BP that you’re scripting.

  • World Direction: The direction you want to move. The nodes that are wired into this input are different from the other nodes, that can be executed (like the Add Movement Input node). Instead, these nodes are evaluated when required. In this case they will be evaluated when the Add Movement Index is executed. It is best to read them from left to right.

  • Get Control Rotation: As the name tells you, this node will get the current rotation of something. Again, the target is an input argument that by default is the BP you’re scripting (self). So this will get you your current rotation. On the right side it has an output (Return Value) of type rotation (purple-ish color) which you can wire to work with this value.

  • Break Rot: A rotation is basically three floating point numbers. Each number tells you the rotation in degrees around a certain axis: Pitch, Yaw, Roll. The Break Rot node will take a rotation value as input and output the three floating point numbers on the right.

  • Make Rot: This is basically the inverse of the Break Rot node. It takes 3 floating point numbers as input and outputs a single rotation value. If you leave one of the inputs unwired, they’ll use the default value (0). So what these two nodes do together is setting the Pitch and Roll values of the rotation to 0, and only using the Yaw (rotation around your own axis).

  • Get Forward Vector: Finally, this node will take the resulting rotation value and create the corresponding forward vector for it, that can be wired to the Add Movement Input as the direction vector.

  • Scale Value: This is probably just multiplied with the direction vector. So basically, if you press the stick only a little bit, the green Axis Value of the input event will be smaller than 1. Multiplied to the direction vector, this will reduce the amount of the resulting movement (making it slower).

https://docs.unrealengine.com/latest/images/Programming/Gameplay/Framework/Input/MoveForward_Blueprint.jpg

I hope this clears things up. It’s little difficult wrapping your head around this stuff, but once you got it, it’s really straight forward :slight_smile:

Thanks that’s a great explanation and helps a lot. I suppose one thing I don’t understand fully is why the Pitch and Roll are zeroed out while the yaw is kept. Could you clarify that please? Thanks so much!

What tutorial or template is this picture from exactly?

Its from the Input section of the documentaiton found here: https://docs.unrealengine.com/latest/INT/Programming/Gameplay/Framework/Input/index.html#playerinput

One thing, Bajee, is I can’t seem to get the “InputAxis MoveForward” to show at all in the blueprint area[solved see next reply:)))]. I’ve tried many things and the closes I can get are Add Controller Pitch Input, Add Controller Roll Input, Add Controller Yaw Input for the Input Add Movement Input. Is there something I’m missing?

Got that part

Oh I see my error, I guess for a new project you have to go to the input settings and add them, ok so I got that part!!!

Sorry to bother you again Bajee, I was wondering if you know of a tutorial that basically can show you from nothing to creating a ball that just rolls around on the ground? I think that might help if I start from scratch because, I think the order in which I try to do things is preventing me from making things work. I know there is a rolling ball example, but I would like to go through the process and thought ina tutorial form. Thanks so much again, I know you are busy and I value your time.!

You’re right, you have to setup your controls in the project settings.

My guess is, that you set the Pitch and Roll to 0, because you only want to move forward. If you took all three rotations into account, the resulting direction vector could maybe point upwards.

Just examining the template is probably the best you can do. Either just play around with the scripts, change values, change scripts and see what happens. Or start your own project and try to create it on your own, peaking over into the rolling ball template if you’re stuck.

Ok thanks for your help, much appreciated!