I have a pawn that I UnPossess at some point, but I want the camera to:
- Stay on the pawn as it is now
- Then move to a new position smoothly
I created a CameraActor at the second position so that I can use PlayerController->SetViewTargetWithBlend. This all works fine as long as I don’t UnPossess the pawn. When I call UnPossess, that seems to nullify any call to SetViewTargetWithBlend in the same frame. It also resets the view to (I think) the PlayerController’s position. Setting it back to the previously possessed pawn seems to have no effect when attempted in the same frame. Has anyone encountered this before and have an idea on how to achieve what I want? Here are some things I tried.
Doesn’t work, because UnPossess takes the camera away from the pawn and the call to SetViewTargetWithBlend has no effect in the same frame:
PC->UnPossess(); PC->SetViewTargetWithBlend(CombatCamera, 0.6f, EViewTargetBlendFunction::VTBlend_EaseIn, 0.5f, true);
Call to SetViewTarget again has no effect:
APawn * PreviousPawn = PC->GetPawn(); // Checked to be non-null ... PC->UnPossess(); PC->SetViewTarget(PreviousPawn); // No effect
I would be okay with starting the SetViewTargetWithBlend 0.1 seconds after UnPossessing, but the camera still snaps away for a frame when calling UnPossess which is annoying to look at. Any suggestions?