Checked this out - had a go at it in C++ but was having some weird behaviour with the camera moving to the given location / rotation, I eventually resorted to just writing up my own interp functionality, where firstly on the POI actor I have a BeginFocus method triggered when the player interacts with the POI actor:
void APinchPoint::BeginFocus()
{
bTransitionBackActive = false;
bTransitionForwardActive = true;
SetActorTickEnabled(true);
}
Then in the tick function, it has this block which will interp the camera to the UCineCamera’s position before performing the set view target
if (bTransitionForwardActive)
{
if (PlayerCamera->GetComponentLocation().Equals(CineCamera->GetComponentLocation(), 1.f))
{
UGameplayStatics::GetPlayerController(GetWorld(), 0)->SetViewTargetWithBlend(this, 0.1f);
bTransitionForwardActive = false;
SetActorTickEnabled(false);
}
else
{
PlayerCamera->SetWorldLocation(FMath::VInterpTo(PlayerCamera->GetComponentLocation(), CineCamera->GetComponentLocation(), DeltaTime, 1.f));
PlayerCamera->SetWorldRotation(FMath::RInterpTo(PlayerCamera->GetComponentRotation(), CineCamera->GetComponentRotation(), DeltaTime, 1.f));
}
}
And then when the player releases the interact button, it calls the EndFocus method on the POI actor:
void APinchPoint::EndFocus()
{
if (UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0)->ViewTarget.Target == this)
{
UGameplayStatics::GetPlayerController(GetWorld(), 0)->SetViewTargetWithBlend(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
}
bTransitionForwardActive = false;
bTransitionBackActive = true;
SetActorTickEnabled(true);
}
Which will enable the following block in tick to enable moving the camera back:
else if (bTransitionBackActive)
{
if (PlayerCamera->GetComponentLocation().Equals(OriginalCameraLocation, 1.f))
{
bTransitionBackActive = false;
SetActorTickEnabled(false);
}
else
{
PlayerCamera->SetRelativeLocation(FMath::VInterpTo(PlayerCamera->GetRelativeLocation(), FVector::ZeroVector, DeltaTime, 1.f));
PlayerCamera->SetRelativeRotation(FMath::RInterpTo(PlayerCamera->GetRelativeRotation(), FRotator::ZeroRotator, DeltaTime, 1.f));
}
}
It’s a bit rough at the moment but it gets the job done! I might look at the MoveComponentTo a bit more further in the future though…