UGameplayStatics::GetAllActorsOfClass(GetWorld(), APlayerCharacter::StaticClass(), FoundActors);
PlayerCharacter = Cast<APlayerCharacter>(FoundActors[0]);
if (PlayerCharacter)
{
SetViewTarget(PlayerCharacter);
}
CameraPawnRef = Cast<ACameraPawn>(GetPawn());
if (CameraPawnRef != nullptr)
{
CameraMovementRef = CameraPawnRef->PawnMovementComponent;
}
SetViewTarget(CameraPawnRef);
Managed to use GetAllActorsOfClass() correctly. Now when I set the view target to player it uses players original camera with all the associated zoom/rotate controls I did for it before. When I set the view target back to CameraPawn its still stuck on player and can’t move but now it uses its own zoom/rotate controls. I want to toggle between following the player and free moving camera preferably only using the CameraPawn but if I can properly switch between the 2 cameras I guess that’d be ok too even tho there’d be 2 set of codes for camera controls.