Hi,
I got a problem once again:
My game is basically a 2D environment and when I click at one point I want my character to rotate towards that point over time.
Different control option is for the character to always rotate towards the cursor.
Because I’m also implementing the second option I have to do this in Tick().
Now, my question is: How can I make a smooth rotation towards that point over time?
My current code looks like this:
FRotator targetRotation = FRotator(GetActorRotation().Pitch, GetActorRotation().Yaw - deg, GetActorRotation().Roll);
this->AddActorLocalRotation(FMath::Lerp(GetActorRotation().Quaternion(), targetRotation.Quaternion(), 1.f));
All this code is in Tick();
deg is the degree the character has to rotate. This is calculated correctly as far as I can tell. So far this code only jumps to the finished rotation. I don’t want this. I want the character so slowly rotate.
When I had this problem in Unity I could solve it with Slerp or Lerp so I guess it should work here, too. What am I doing wrong?