Hello,
I completed the course and did also the mega challenge.
I learned a lot and now I’m going back to try to repeat some steps that I found particularly interesting, including this lesson that implements the AI controller.
Let me say that in your course everything worked perfectly, the character rotated and followed the player pawn.
I tried to do the exactly the same thing but starting from the 3rd person character template available when creating a new UE4 project. I did the following steps :
- I created MyAIController.cpp
#include "MyAIController.h"
#include "Kismet/GameplayStatics.h"
void AMyAIController::BeginPlay()
{
Super::BeginPlay();
APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if (PlayerPawn != nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Set of Focus OK"));
SetFocus(PlayerPawn);
}
}
- I created MyAIController_BP from MyAIController.cpp
- I set ThirdPersonCharacter->AI Controller Class -> MyAIController_BP;
- I spawned a ThirdPersonCharacter in the scene but it doesn’t rotate to follow player pawn as it should.
It all seems the same to me as the course code.
Any idea where the error could be ?