This is the best I could come up with to interpolate over a second
Now, the thing is, light interpolation works fine, but the color behaves in a strange way.
It interpolates fine when transitioning from certain curve point to another.
But when it tries other points, nothing happens, unless i move cursor from PIE viewport window, so viewport game fps is decreased, only then it works (and if I set 30 fps in the settings).
And, again, it works just fine when transitioning at other curve points.
There may be smtg I’m missing or messed up. But, in any case, I find such behaviour strange.
I’m using 4.27 version, if that matters. Video Example
Worth mentioning: tempColor = FMath::CInterpTo( currentColor, targetColor, DeltaTime, 1 );
also doesnt work, unless the frame rate is set to 30, or the interp speed is set to 2 or higher with 60 fps.
I’m new to c++, don’t know how to cast properly, so I’ve tried these options: (float)(1) static_cast< float >(1) 1.0f
Neither fixed the issue with that FMath::CInterpTo.
tempColor = FMath::CInterpTo( currentColor, targetColor, DeltaTime, 1.0f);
should work. I’m guessing this is in the tick function and you are passing in the delta time?
This can give better results than a normal lerp, but is much more expensive.
I’d prefer to avoid heavy things in ticks.
And I initially avoided lerps, coz I wanted the interpolation to take an exact amount of time.
Also, it doesn’t work with lerp alpha = 0.02 and lower.
Ok so looking at the debug info it kept reverting to the source color. You need to override the source with the output from the temp color.
Normally in timeline lerps you don’t change one of the lerp parameters at runtime but here during tick it seems to be necessary.
Example actor that lerps successfully between two set colors at a certain speed.