Change camera on death to killer camera [c++]

Hello, on death i want to set dead player camera to the killer camera(make him his spectator)
(You die → you spectate player who killed you)
So now i do it:

APlayerController*PlayerController = UGameplayStatics::GetPlayerController(this, 0);

	PlayerController->SetViewTargetWithBlend(DamageCauser, 2.0f);

And its setting Camera of damagecauser to a place in damagecauser’s stomach(?)

I tried reversing to see if it works the opposite way:

APlayerController*PlayerController = UGameplayStatics::GetPlayerController(DamageCauser, 0);

	PlayerController->SetViewTargetWithBlend(this, 2.0f);

And now it sets Damagecauser camera to killed player camera. But i dont know why it wont work like i want it to.

Death Code:

	APlayerController* OurPlayerController = UGameplayStatics::GetPlayerController(this, 0);

	OurPlayerController->SetViewTargetWithBlend(DamageCauser, 2.0f);

	

	bDied = true;
	UE_LOG(LogTemp, Log, TEXT("die"));
	GetMovementComponent()->StopMovementImmediately();

	GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision);

	DetachFromControllerPendingDestroy();

	SetLifeSpan(5.0f);
	CurrentWeapon->SetLifeSpan(5.0f);

Is there a param on the camera manager for view offset or character eye height?
Do you need to set the target to the Character pawn or to the controller?

Sorry I was gone so long. Does it Work to set the view target not to the killer player pawn but to the killer pawn’s camera component?

Hi mightyenigma! When i was writing this post i didn’t know that i can’t get other player controller from scharacter, but now i know how to do everything :slight_smile: