Hello,
I know there’s already a lot of threads explaining how to setup inputs in the playercontroller to move my pawn, but I tried to do so but I still can’t manage to make it work. I’ve made a new PlayerController class, called CampaignPlayerController and I’ve also made a new public function, which is virtual void SetupInputComponent() override. Here’s my .h file for my controller:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "CampaignPlayerController.generated.h"
/**
*
*/
UCLASS()
class PRIMALWARS_API ACampaignPlayerController : public APlayerController
{
GENERATED_BODY()
public:
ACampaignPlayerController();
protected:
public:
virtual void SetupInputComponent() override;
};
And here’s my .cpp file:
// Fill out your copyright notice in the Description page of Project Settings.
#include "Controllers/CampaignPlayerController.h"
#include "Characters/CharacterBase.h"
ACampaignPlayerController::ACampaignPlayerController()
{
// Sets default values
}
void ACampaignPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
InputComponent->BindAxis("MoveForward", this, &ACharacterBase::MoveForward);
InputComponent->BindAxis("MoveRight", this, &ACharacterBase::MoveRight);
InputComponent->BindAxis("LookUp", this, &ACharacterBase::AddControllerPitchInput);
InputComponent->BindAxis("LookRight", this, &ACharacterBase::AddControllerYawInput);
}
Also, the functions MoveForward() and MoveRight() are defined in my Character-class. I’m simply trying to move my character using the player controller that I’ve made. How do I do this? The code above doesn’t work and gives me red underlines my super-call, and gives me an error saying:
FInputAxisBinding &UInputComponent::BindAxis(const FName)': cannot convert argument 3
from 'void (__cdecl ACharacterBase::* )(float)' to 'void (__cdecl ACampaignPlayerController::* )(float)
If anyone could help me it would be highly appreciated! Thanks in advance
~Stefan