How can I rotate the player character to face the mouse cursor?

I am creating a top-down game in which the character is controlled via WASD and the rotation is based on the current mouse location. I cannot figure out how to convert the current mouse location to some sort of FRotator or FQuat.

My current thought process:

I know the player will always be located in the center of the screen. I would need to get the direction that the player is facing on the X-axis and use simple Trig to determine the angle based on the mouse location.

Unfortunately I do not know how to do this. The documentation I am finding seems largely based on UnrealScript and Unreal 3. Any help would be greatly appreciated.

EDIT: Added code used in solution.

void RotateToMouseCursor() {
  // Get current mouse rotation
  FVector mouseLocation, mouseDirection;
  this->DeprojectMousePositionToWorld(mouseLocation, mouseDirection);

  // Get local reference to the controller's character and its rotation
  ACharacter *currentChar = this->GetCharacter();
  FRotator charRotation = currentChar->GetActorRotation();

  // Get the rotation of the mouse direction
  FRotator targetRotation = mouseDirection.Rotation();

  // Since I only want to turn the character relative to the ground, 
  // the Yaw is the only change needed.
  FRotator newRot = FRotator(charRotation.Pitch, targetRotation.Yaw, charRotation.Roll);

  currentChar->SetActorRotation(newRot);
}

You can use this to find the rotation of your character.
Start is you character location, target is the mouse location.

4797-findlookat.png

][1]

Thanks for the reply. I am not using blueprints. This question is in the C++ Programming section with the C++ tag.

Oh ok, i didn’t saw that.
In C++, you just take the Direction.Rotation(), it will return the rotation of Vector Direction.

Thank you very much for your help. I have added an edit to show the code I am using.