Hi guys, i am a bit confused at this stage. i am trying to do simple stuff. in this case spawn ACamereaActor in some
location i said, fixed. Then using APlayerController, look at my player. (Arkanoid game).
i tried A LOT of codes, searched Google, and the forum and called Mister unreal Engine Junior, but i cant figure out how to do it. The camera simply stays at (0,0,0), no matter what, and i know its becouse of his mobility, but i tried to configure the mobility almost in every place reasonable. Here is my code , sorry the mess i am a bit tired.
A- i dont know how to spawn my custom “AMyCustomPlayerController”, i saw no example or Doc about it . i just spawn the default PlayerController.
B- i dont know how to fix the problem of not being able to set the location of my camera.
C- i dont know how to say to the default PlayerController to use ACameraComponent, it simply doesnt wanna work(check the code).
5Hs+ working on this, i quit, till tomorrow.
i checked a lot of possible solutions to those 3 questions but i couldnt fix one.
void AMyGameMode::StartPlay()
{
Super::StartPlay();
StartMatch();
APlayerController* playerController = UGameplayStatics::GetPlayerController(this, 0);
playerController->bAutoManageActiveCameraTarget = false;
UWorld* const World = GetWorld();
if (World){
ACameraActor* camaraPrincipal = World->SpawnActor<ACameraActor>(GetClass(), FVector(-90.0f, 20.0f, 170.0f), FRotator());
camaraPrincipal->CameraComponent->SetMobility(EComponentMobility::Movable);
camaraPrincipal->SetActorLocation(FVector(-90.0f, 20.0f, 170.0f), false);
playerController->SetViewTarget(camaraPrincipal);
}
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("HELLO WORLD"));
}
}
PD: i have no compile errors nor nothing similar. i add code and then i check if it works.