bUsePawnControlRotation Causes Camera Jerk

I am experiencing a jerk motion when toggling the bUsePawnControlRotation on my spring arm component. I am currently using the following two function when my character is aiming and would like to know how I can stop it from jerking. I have recorded a video to demonstrate what I have been experiencing. It looks like when I set the bUsePawnControlRotation back to true, it snaps to the mouses position or something like that.


void AThirdPersonCharacter::Aim()
{
	//Move the camera boom
	if (CurrentWeapon != NULL)
	{
		CharacterRotation = GetActorRotation();
		if (bIsCrouching)
		{
			GetCharacterMovement()->MaxWalkSpeed = CrouchSpeed;
		}
		else
		{
			GetCharacterMovement()->MaxWalkSpeed = AimingSpeed;
		}
		bIsAiming = true; 
		CameraBoom->bUsePawnControlRotation = false;
		CameraBoom->bDoCollisionTest = false;
	}
}

void AThirdPersonCharacter::StopAiming()
{
	//Stop aiming and move the camera back
	bIsAiming = false;
	if (!bIsCrouching)
	{
		GetCharacterMovement()->MaxWalkSpeed = WalkSpeed;
	}
	CameraBoom->bUsePawnControlRotation = true;
	CameraBoom->bDoCollisionTest = true;
	FRotator ActorRotation = GetActorRotation();
	ActorRotation.Pitch = CharacterRotation.Pitch;
	this->SetActorRotation(ActorRotation);
	GetCharacterMovement()->bOrientRotationToMovement = true;
}

I added this line to the StopAiming function which seem to fix some but not all off the jerky motion


GetWorld()->GetFirstPlayerController()->SetControlRotation(GetActorRotation());

What else should I try?

The spring arm (which you named CameraBoom) may have an option activated to lag. Check whether bEnableCameraLag or bEnableCameraRotationLag are activated.

Thanks the bEnableCameraRotationLag did the trick!