FRotationMatrix not giving updated values?

Hi all,

Trying to get an actor to slowly turn towards a location, I couldn’t get the KismetMathLibrary for FindLookAtRotation working in the code* so I instead followed another answer here that suggested

void AShipAIController::Tick(float DeltaSeconds){
if (bIsDestinationSet){
	AShip* ship = Cast<AShip>(this->GetPawn());
	FVector currentLocation = ship->GetActorLocation();
	FRotator rotation = FRotationMatrix::MakeFromX(CurrentDestination - currentLocation).Rotator();

	float rotationYaw = rotation.Yaw;
	float turn = TurnRate;

	//If negative rotation, multiply turn speed by -1
	if (rotationYaw < 0){
		turn = turn * -1.0f;
	}

	//Turn actor
	FRotator turnby = FRotator(0, turn, 0);
	ship->AddActorLocalRotation(turnby);
}

}

I want to be able to stop the rotation once the object is facing the target. Mainly I was thinking if I kept calculating the rotation from FRotationMatrix until it got somewhere close to 0 I could implement some stopping logic. However, the rotation from FRotationMatrix never changes even though I can see the actor rotating in the viewport.

Any ideas why, or am I thinking about this all wrong? Does the FRotation matrix provide a angle between two points, or does it provide the amount of rotation needed to face it?

Thanks.

*The problem I had with KismetMathLibrary is that when compiling visual studio could not find “KismetMathLibrary.h”, if you know how to fix this, please do tell.

As I was writing my question I kind of had a realization that the FRotationMatrix only provides a target and not the amount needed to rotate. So with that understanding:

void AShipAIController::Tick(float DeltaSeconds){
	if (bIsDestinationSet){
		AShip* ship = Cast<AShip>(this->GetPawn());
		FVector currentLocation = ship->GetActorLocation();
		FRotator rotation = FRotationMatrix::MakeFromX(CurrentDestination - currentLocation).Rotator();

		float rotationYaw = rotation.Yaw;
		float turn = TurnRate;

		float currentYaw = ship->GetActorRotation().Yaw;

		float yawDifference = FMath::Abs(rotationYaw - currentYaw);
		if (yawDifference <= TurnRate){
			turn = yawDifference;
			bIsDestinationSet = false;
		}

		//If negative rotation, multiply turn speed by -1
		if (rotationYaw < 0){
			turn = turn * -1.0f;
		}

		//Turn actor
		FRotator turnby = FRotator(0, turn, 0);
		ship->AddActorLocalRotation(turnby);
	}
}