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);