SetViewTarget not compatible with UCameraComponent

So im new to unreal and i’ve created an actor (character type class) and added 2 cameras to the root node (capsule). As well as a camera boom:

// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character	
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller

// Create a follow camera
RPGCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("RPGCamera"));
RPGCameraComponent->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
RPGCameraComponent->bUsePawnControlRotation = false; // Camera does not rotate relative to arm

// Create a FPS camera
FPSCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FPSCamera"));
FPSCameraComponent->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FPSCameraComponent->bUsePawnControlRotation = false; // Camera does not rotate relative to arm

However im trying to switch to the FPSCamera when hitting the jump key (just for debugging) but when I do something like this:

(btw I also have:

/* Player Controller Pointer*/
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);

setup in my header file)

void ARPGCharacter::StartJump()
	bPressedJump = true;

It complains saying “argument of type UCameraComponent is not compatible with parameter of type AActor*”

Do I need to “cast” this or something (Which im still not SUPER familiar with in Unreal). I tried just building and got a lot of

Error C3861 ‘GetPlayerController’:
identifier not

But the only red squiggly in Visual Studio 2019 was within the ->SetViewtarget portion

The error you are getting when building (Error C3861 ‘GetPlayerController’: etc…) is probably because the compiler has no idea where that function is. C++ compiler is dumb, and you need to tell the compiler where to find it by including UGameplayStatics in the source file you are trying to use GetPlayerController in. You must put this line at the top of that source file:

#include <Kismet/GameplayStatics.h>

Furthermore: APlayerController::SetViewTarget is not what you want to be doing when switching between multiple UCameraComponents on the same actor. Pay attention to the function parameters! It is asking for an Actor* as the first parameter. You only want to use this function when you have an entirely separate Actor that contains a UCameraComponent and you want the player’s actor to use this to render the scene.

For your task I think you’re supposed to call UActorComponent::SetActive on your actor’s camera components. Once on the camera you want to deactivate, and once on the camera you want to activate. You can see an example in blueprints here, but the C++ code should look very similar. There’s also a ToggleActive() function in there as well, which may make things look a little bit cleaner.