View not immediately switching to camera of possessed character

Hi All

I’ve got a switch from default pawn to the player possessing a character, that’s giving me trouble. When the character is possessed, the camera position is initially at waist height, and updates to the correct position when you move the camera. In the constructor of the character I’ve got;
bFindCameraComponentWhenViewTarget = true;

I’m trying to use the playercameramanager to get it to update faster, so far I’m not really understanding what it’s doing, because its not working. This code is in the character class;

void ARRDevelopCharacter::OnBeginOverlap(AActor* Other, class UPrimitiveComponent* OtherComp, int32 OtherBodyIndex) {

GEngine->AddOnScreenDebugMessage(0, 2.0f, FColor::White, TEXT("Begin Overlap"));

APawn* Test = UGameplayStatics::GetPlayerPawn(OtherComp, 0);

if (Other == Test) {

	GEngine->AddOnScreenDebugMessage(3, 2.0f, FColor::Blue, TEXT("Actor is Player Pawn"));
	AController* PlayerController = UGameplayStatics::GetPlayerController(Test, 0);
	APlayerCameraManager* PlayerCameraManager = UGameplayStatics::GetPlayerCameraManager(Test, 0);

	float DeltaTime = UGameplayStatics::GetWorldDeltaSeconds(this);

	PlayerController->Possess(this);

	PlayerCameraManager->SetViewTarget(this);

	PlayerCameraManager->UpdateCamera(DeltaTime);

	Test->Destroy();
}

How to update the camera position at the moment the character is possessed???

Many thanks!

Once again, I misunderstood what was happening;

The character camera is on a boom, and when the pawn view switches to the character view, it sets the character camera in the position of the pawn view. Not a location that would be possible to reach if you were controlling the character, but nonetheless, it had immediately switched to the character camera.

The solution was to “manually” set the position of the character camera, immediately after possess.

Thanks for getting back to us, and letting us know how it got sorted.