Finterp set duration in seconds?

Hello!
I am wondering how could I set interpolation between two values with duration, instead of the default “speed”. The speed is very vague, and I don’t have much idea about it’s timing.

Here is seen that I am using different “function” for different cases, and setting it’s position thorugh finterp constant - though as I said, I have no cloe if I want the transition to be one second, how to set it with the speed correctly:


Thank you.

Hey again :slight_smile:

The interp nodes are intended to be a constant interpolation on Tick, not having a start and end really. That’s why there’s no specified timing.

Timelines with a specified curve or iTween Float From/To is the way to go for this use case:


iTween : Free, smooth, procedural object animation
easyCSV : Read data from any CSV and put them in an easy-to-access string map!
Runtime DataTable : Import and export game data to and from CSV or Google Sheets while your game is running!

2 Likes

Never mind, I used timers instead, and it’s much cleaner too. There I can set specific duration, and through mapping the range and clamping it, I get clean 0 - 1 alpha values, which I can then feed to Ease node. I have this in an actor component class, so I can pretty much have it anywhere to modify rotation of components - without using timelines or lerps. Screenshot if it helps anybody:

4 Likes

Hey dude,
this is super easy to do:
Just divide “1” by the number of seconds you’d like the FInterp transition to take.

3 Likes

interp speed for a constant interp is a per-second multiplier.

The person who said to divide by one is trying to be cute but they are not wrong, except if you think about it for a second you’ll know that dividing a number by one does not change the number. I couldn’t find a definitive answer to how “interp speed” works for the “constant” interp nodes either so I set up this test to verify:


of course if my float started at “6” instead of “0” then it would take 6 seconds to reach 12 instead of 12. So that’s how it works - interp speed for a constant interp is a per-second multiplier.

@PalCorral.jacob Your conclusions about how InterpSpeed in Finterp to Constant node works are right.
@Joachim does not divide by one but divide one by number. Big difference. It’s sometimes nice trick to change speed ratio to value in second’s but it doesn’t seem to work in this case.
From my experience InterpSpeed is how much the value will change in one second.
Examples:
If you want to change value from 0 to 10 in 10 sec use InterpSpeed 1.
If you want to change value from 0 to 10 in 5 sec use InterpSpeed 2.
If you want to change value from 0 to 10 in 20 sec use InterpSpeed 0.5.
Etc…
Of course DeltaTime, Current and Target must be connected and set to variable properly.

So the formula for InterpSpeed in seconds would be:
difference between current and target value / seconds you want transition to take

There’s a lot of confusion about what Finterp actually is and does, so I thought I would clarify. The first reply by Jared Therriault is the best answer though.

++++++++++++++++++++++++++++++++++++++
What does Finterp Mean?
++++++++++++++++++++++++++++++++++++++

Finterp stands for Floating point Interpolation. This means it returns a float over time to smoothly transition between a Current and Target value. Notice I said Current value. This means that you need to always be feeding it the current value and not a starting value. Easy way to do this is to Get the current value (whatever it may be) and plug it into Current on the node, and then Set the the current value and plug the result into it, thus creating a loop where it is always updating itself. Alternatively you could get a value on Tick, but that is more expensive.

The reason I say over time is because the transition between the two values is driven by delta time. Either World Delta Seconds, or the Delta Time from an Event Tick. The only difference between Event Tick Delta and World Delta is that you can’t get a Delta Time value without using Event Tick, so they created the World Delta node to give you the same value even if you’re not using Event Tick. IE the values are always identical, it’s just where you’re getting the value from.

++++++++++++++++++++++++++++++++++++++
What does Delta Time Mean?
++++++++++++++++++++++++++++++++++++++

The definition of the phrase “Delta Time” just means a variance between values over time. In the case of blueprints, this means the difference in time between the last frame generation and the current one (technically there’s a Delta Time in networking too, it’s just the difference between data packets and not frames). This means that the value of Delta Time is typically very small unless you hit a major stutter (drop in performance).

++++++++++++++++++++++++++++++++++++++
Explanation of the different Finterp Nodes
++++++++++++++++++++++++++++++++++++++

There are several Finterp nodes and you’ll notice the only difference is the shape of the curve it uses for the transition (blending).

Finterp Constant means it uses a constant curve or more simply put; a linear curve. A linear curve gives you a transition with an instant start and stop. Think of a robot’s arm moving.

The Finterp To node uses a smooth or horizontal slightly S-shaped curve. This means it starts slow, accelerates towards the target value, and slows down a bit before it reaches the target. Think of giving an open door a soft shove and how it will slow down before stopping.

The Finterp Ease in Out node is like a Finterp node with a smooth curve, but it is driven by an alpha value and does not use either Delta Time or Interp speed. For the alpha value, you could use a timeline, a timer, or even the Game Time in Seconds or Game Time Since Creation nodes. The Exponent value specifies the number of times the value is multiplied by itself. In plain English, this is called the Power. For the purposes of this node, it controls the degree of the curve and is used to exaggerate the transition.

++++++++++++++++++++++++++++++++++++++
What do the Finterp nodes actually do?
++++++++++++++++++++++++++++++++++++++

Finterp is a way of smoothly transitioning between two values as they change. It does NOT blend from one Value to another value over time like a Lerp node. Instead what it’s doing is making the change between floats have a smoother transition and the amount of the change is driven by the time between the last frame and the current frame.

The interp speed determins the length or distance of the transition, and it is not “seconds” nor is there a way to convert this to seconds (1/seconds is how you adjust the playrate of a timeline or something similar by converting the seconds into a float).
A higher Interp Speed value means it will transition to the target quickly by making the transition speed or length shorter.
A lower value will increase the length of the transition.

++++++++++++++++++++++++++++++++++++++
Practical Usage Example:
++++++++++++++++++++++++++++++++++++++
If you wanted to adjust the scale of a static mesh every time you press a key, you would notice that the scale of the mesh would jump instantly to the new value every time you press the key.
The Finterp nodes would be used to smoothly transition between the two values providing some easing so that it’s not abruptly jumping from one value to another.

++++++++++++++++++++++++++++++++++++++
TLDR:
++++++++++++++++++++++++++++++++++++++

Finterp is not the same as Lerping. You are not blending from one value to another over time (alpha).
Instead, you are smoothly transitioning BETWEEN the CURRENT and TARGET values whenever those values change; typically between frames.
The value returned is “between” the two specified. For Example, it will return 2.5 if your current is 0 and Target is 5. However, as the values change, the returned value will also update to always be in between the current value and the target.

Read the Practical Usage Example for a quick explanation of how to use the nodes.
To copy my nodes for your own testing, use this link:

Be sure to paste it into a level blueprint and remember to add a cube and connect it to the unknown node (Ctrl + Left Click Hold, + Drag).

3 Likes

Also, I should add separately that if you want to blend between two values over X time with Tick you can do this:
Get the Delta Seconds from the Tick and promote it to a variable
Get the Delta Seconds variable and divide it by the number of seconds you want the blend to take
Plug the result into the Alpha of a Lerp node and it will blend from A to B over X Seconds

TickLerp

1 Like