Camera is not being Possessed

Hi guys,

I’m in need of help. I have created an actor with the following components

231393-capture.png

These are inherited from a C++ class I’v made, which is all fine. The camera has auto activate on. I’ve placed the BP in the world and set auto-posses to player 0. I can use my movement fine, but for some reason the camera being used is the CameraActor which is spawned in by default, rather than the camera set up on my player.

As you can see, the current camera is CameraActor, but there’s a camera that should be taken over sitting on the pawn, but it’s not.

Any help would be appreciated.

You either have wrong player ID set (you need to do it if you want this auto possess to work,) or you player controller have bAutoManageActiveCameraTarget to false, which makes possession to not set view target, since possession (taking control of pawn) and setting view target (setting actor that should be viewed in camera) are separate process. By default bAutoManageActiveCameraTarget is true so possession should also set view target. Look what happens in pawn initiation regarding auto possession:

if (AutoPossessPlayer != EAutoReceiveInput::Disabled && GetNetMode() != NM_Client )
{
	const int32 PlayerIndex = int32(AutoPossessPlayer.GetValue()) - 1;

	APlayerController* PC = UGameplayStatics::GetPlayerController(this, PlayerIndex);
	if (PC)
	{
		PC->Possess(this);
	}
	else
	{
		GetWorld()->PersistentLevel->RegisterActorForAutoReceiveInput(this, PlayerIndex);
	}
}

By look of that you case behave like bAutoManageActiveCameraTarget is false as you getting input but view target is not set, you can easily correct whatever is happening by calling “SetViewTarget” for player controller after your pawn is on the level, you can do that in Blueprints too.

Not sure what was wrong with the camera. But I recreated my the C++ class and put it in a new level and it worked.