Turn mouse input into rotation?

I can’t understand the code. But I do know that UE provides an out-of-the-box way of converting input to pawn/character movement.

Binding mouse input to movement can be done with the following two steps. The example will be for using the mouse to rotate the character.

  1. Setup your input bindings in project settings.

  1. Bind the input to AddControllerYawInput in SetupPlayerInputComponent.
void ACharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
  PlayerInputComponent->BindAxis(TEXT("Rotate"), this, &APawn::AddControllerYawInput);
}