Need help implementing player input

I’ve been following the book learning c++ by creating games on ue4. I’m now trying to implement player input, but cant get it to work. The book is kinda old, so maybe things have changed since then. I’ve looked for some help at the unreal input page and a few tutorials on youtube (the ones that aren’t on blueprints), but neither seem to work.
My header file:



// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Avatar.generated.h"

UCLASS()
class GOLDENEGG_API AAvatar : public ACharacter
{
GENERATED_BODY()

public:
// Sets default values for this character's properties
AAvatar();

protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;

// Called every frame
virtual void Tick(float DeltaSeconds) override;
public:
// New! These 3 new member function declarations
// they will be used to move our player around!
void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
void MoveForward(float amount);
void MoveRight(float amount);
};


My cpp file:



// Fill out your copyright notice in the Description page of Project Settings.


#include "Avatar.h"

// Sets default values
AAvatar::AAvatar()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AAvatar::BeginPlay()
{
Super::BeginPlay();

}

void AAvatar::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
check(InputComponent);
InputComponent->BindAxis("MoveForward", this, &AAvatar::MoveForward);
InputComponent->BindAxis("Strafe", this, &AAvatar::MoveRight);
}

void AAvatar::MoveForward(float amount)
{
if (Controller && amount)
{
FVector fwd = GetActorForwardVector();
AddMovementInput(fwd, amount);
}
}

void AAvatar::MoveRight(float amount)
{
if (Controller && amount)
{
FVector right = GetActorRightVector();
AddMovementInput(right, amount);
}
}


hu. There was a live training on this subject too… its dated, but maybe you can figure it out.
that said, we can’t help you without an error message or something to that effect.
“can’t get it to work” isn’t very descriptive…

Here’s the live training… or rather. You need to fish out the one he talks about, camera movement.
Can’t find it, but I know ai watched some of it.

a different starting point (nothing to do with what you need but still).

BTW, you can also create a 3rd/1st person cpp project and break it apart.

This was the only way to express what’s happening because there is no error message. The character just won’t respond to input.

I’ll take a look at this, thank you