Using Linear Interpolation: TargetYaw & CurrentLocation floats

Why do we need to declare the two floats TargetYaw & Current Locations.
I tried including only values in the Lerp (below):
FRotator TargetLocation;|
TargetLocation.Yaw = FMath::Lerp(0.f, - 90.f, 0.001f);|
GetOwner()->SetActorRotation(TargetLocation);|

Both doors became wide open, without any animation, i.e., did not lerp :slight_smile:

Just an update, apparently the issue is in the Current location, because I replaced the TargetYaw with a value & the code still works fine.

Lerp is just a + (b -a ) * c

So what you have there is -90 * 0.001 which is -0.09 and itโ€™s never changing from that.

What is done with the lectures is to always update the value used for a.
Given what the lecture does with your values of -90 and 0.001 the calls would be

0        + (-90 - 0)        * 0.001 = -0.09
-0.09    + (-90 - -0.09)    * 0.001 = -0.17991
-0.17991 + (-90 - -0.17991) * 0.001 = -0.26973009
...

Eventually it will get to -90 and stop around there.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms