Set actor rotation / Lerp / Smooth?


I am trying to smoothly rotate an actor 90 degrees when i press a Key

However, every method i try results in incorrect numbers. For example it will not go 90 degrees but 89.9998 or 91.00004

As a result of the incorrect numbers when i press it again it wont be 180 it will be 178.
So the issue becomes more and more obvious with rotation getting more and more inaccurate.
Ways i have tried doing this.

Please note
In the screenshot it says 90. But what i used is 1.
The timeline is 90 seconds.
So technically it should add 1 over a period of 90 seconds but ends up with 156.9867

Another way i tried but is not in the screenshot was to set a variable to +90 and combine that with the vector of the player. But that resulted in even worse result.

If i remove any lerping functions then it goes as intended. 90, 180, -90, 0
But i need the lerp. Any help would be appreciated.

Thank you for the response. Will keep an eye on the other users progress.
I originally started with the top down blueprint. But have since change everything significantly.

My blueprint runs as the controller blueprint which calls the controlled pawns as i am creating a puzzle game where u can change pieces. I would say therefor perhaps 3rd person.

I have experimented with various methods but none of them seems to be going to well. I started reading up on timeline events. I was hoping that if it reach a specific degree i could trigger an event that simply stops the timeline.

Will keep investigating until the rounding to non whole number issues are resolved. Thanks again

Hi Crocopede,

It’s a known issue that the Lerp and a few other values in the editor will default to a non-whole number. It is a long standing issue that our developers are currently looking into.

What type of character setup are you using this on? 1st/3rd person or 2D?

Here is another user trying to accomplish the same feature except without the lerp node.

Thanks, TJ

I’m actually going to step i here and say this problem is not specific to UE4, it happens in Unity as well as Hero Engine and many other engines I’ve worked with over the years. The work around I’ve used (it’s a bit dirty) is to round the number to the nearest integer at the end and start values

The rounding method is more elegant than what I came up with (its a 10 degree rotation 9 times (90 degrees) with a 0.015 delay between each rotation)
:D… D: