Am I using Lerp (Rotator) wrong (or use Rinterp)?

Hello everyone,

I recently tried some simple things in blueprints and was confused by what was happening.

What I want to achieve:
A Blueprint Actor placed in my level which is controlled via external inputs (getting signals via OSC, that part is working without problems). Basically I’m setting a target rotation when I receive an Event, which then should lead to the Blueprint Actor rotating from it’s current rotation, to the rotation target set.

Setup:
As I wanted to have some follow up Animations (graphics on the Hud fading in when receiving the finished tick from the timeline), I set up a timeline, animating a float from 0 to 1 in a certain time and connected everything to a Lerp (Rotator) Node.
As I understood it, the Node “fades” between the Value A and B via the alpha Value it receives.

I actually thought this worked until I tried to change the length of my Timeline (therefore the length of the rotation time) and I recognized that it’s not really influencing the Lerp in the way I would have imagined.
Even if I set the Timeline length (and of course the corresponding keyframes in it) to long times like 10 seconds, the rotation seems to finish in about 1 second.
I printed the timeline output, which is just fine 0 → 1 in the set time.

But the rotation of the lerp is weird, let’s say the current rotation is 0,0,0 and the target is 0, 10, 0 it rotates to ~0.98 in the above mentioned second…and for the rest of the timelineAnimation time it increases in ~0.001 steps.

Am I getting something wrong with the Lerp Rotator here?

I read that Rinterp could achieve a similar effect. I tried this too and it works. My only “problem” with it is, that I wanted to use the timelines “Finished” tick, to set up a popup on myHUD, as the animation finishes.
I’m actually not sure how to achieve this effect with the Rinterp, as I don’t know when the rotation is finished.

Contrary to the “Timleline-Lerp” idea above, where the duration of the animation is set by timeline, the duration of the rotation using Rinterp varies (as the angles between the rotation targets will differ) Therefore a timed fade in of the popup won’t work (if I’m not getting this wrong)

Any suggestions how to solve this would be highly appreciated!

Thanks in advance :slight_smile:

Daniel

The Lerp node will clamp input to between 0 and 1, meaning it only use values from 0 to 1. You should try to divide the alpha value with the total timeline length, then feed the result to the Lerp node.

Hello CKong,
thanks for your response!

As written above I’m already animating my timeline (float) from 0 to 1 as output, which should be in the alpha range?
The output from the timeline seems just fine too hmm.

You might be facing an exponential movement problem with that way that lerp is setup. It happens with certain scenarios.

Try setting the actor rotation as a variable before triggering the timeline, and use that as A in the Lerp.

1 Like

Exactly this was the problem. (A friend that checked the BP with “fresh eyes” saw it too :D)
Simply save the Rotation to a variable so you’re not using the already animated current rotation and it will run smoothly.

As for the Rinterp:
It seems really nice if you want to work with speed (and therefore variable animation lenghts), but you have to do more checking (when is it close to the target → from this point on animate linear or you face an exponential movement problem too as far as I can see)
I guess I try to figure out a solution for this the next time :slight_smile:

Sharing this tip is qualified as a “Hero” move.

Hats off to you, saving the object’s rotator to a variable solved my issue where my rotation was stuttering at the end of the timeline.