Movement Forward/Backward Cam L/R C++ Only

// find out which way is forward
const FRotator Rotation = Controller->GetControlRotation();
const FRotator YawRotation(0, Rotation.Yaw, 0);

		// get forward vector
		const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
		AddMovementInput(Direction, Value);	

Alright. I’ll try to explain what all of this does in a simple way. First and foremost we have a constant FRotator named Rotation. We want this to get the currently controlled rotation by using Controller->GetControlRotation();.

Secondly we’re using another constant FRotator this time it’s named YawRotation because it is going to be using…well, the yaw movement! X,Y,Z coordinate system and all of that jazz. We’re going to give it the variables 0, the Rotation we created earlier and specifically the .Yaw portion and last but not least we’ll set the last variable to 0. We’re only interested in the yaw as of right now.

Then we want to get the forward vector as the commented code says. So we make an FVector variable named Direction and we assign it to the result of FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);

Last but not the least the actual movement itself. AddMovementInput which is what I believe you want. It comes from APawn which your character should be inheriting from. Call the function with the FVector world direction, in this case it is called Direction and then assign it a value. AddMovementInput(Direction, Value);

The value is assigned in the editor itself when mapping the keys. When that key is pressed it will call the function and the value you set in the editor will respond appropriately.

void AThePlanetCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	// Set up gameplay key bindings

	InputComponent->BindAxis("MoveForward", this, &AThePlanetCharacter::MoveForward);

 }

I can understand wanting to do everything by hand and by scratch but it isn’t really necessary when alot of the tools are available for you right from the get-go. There isn’t a need to make it any harder for yourself. Also, I don’t use the blueprints (Albeit they would make things easier and really the Unreal team is awesome for making it!) since I prefer to make everything by code. But… you’re going to learn quickly that you need to work with the editor and not necessarily against it. Side by side making code and using the editor to change things around as well. Trust me on that.

TL;DR

AddMovementInput is what you want if you’re going to do it by scratch. Make sure you’re inheriting from pawn. If you still run into any snags then follow this or send me a message on the forums. Good luck!