# Setting Up Float Math

I have an issue where I’m trying to link my play rate of my timeline to a delay. The way it’s setup is that the higher the play rate, smaller the delay needs to be, and vice versa. I’ve determined a few numbers that work well.

Anyone have any thoughts?

basically if:
Play rate = 2, 1, 0.5, .25 then delay = 0.25, 0.5, 1, 2

Can you show the blueprint?

It’s not fancy and I have just a float * float in there. The issue is that the camera needs to Lerp into position, then the action on the other side of the delay needs to happen. If there’s an easier “wait till this is done, then move ahead” situation, let me know.

Set the timeline play rate before you start running the timeline

Ah, I get you.

You have to put the code together. You can’t put a timeline in a macro or function.

Hmm. That function “LerpBetweenCams” is being called in a few different blueprints from my Character blueprint. It’s a custom function, but it’s not it’s own macro or function. It’s because it calls upon my camera in the character. I wish I could put the timeline in it’s own function and then just send the “Finished” node out the return. The issue is I need enough delay for the timeline to lerp fully, then move on to the next node But in order to lengthen the timeline the float has to go lower, and to lengthen the delay, the float has to go higher.

Gonna be honest, I’ve NEVER even seen a node like that. Geez, that is some high level stuff.
I’m guessing the “Timeline” variable in that is what you’re using to determine the play rate of the timeline? FOr me the play rate is determined by other blueprints, so I’ve set up a “CamLerpRate” variable. Am I using this right?

the higher the play rate, smaller the
delay needs to be

You can always go HAM on the math expression node:

``````((((2 * neg) * (pow(Timeline, 3))) + (7.500000 * (pow(Timeline, 2)))) -  (8.750000 * Timeline)) + 3.750000
``````

This will spit out values for the delay. The function you’re after is not linear.

Not sure what is going on here, are you trying to interpolate between camera positions?
Are you looking for the BP node “SetViewTargetwithBlend” ? That is normally used to switch between cameras smoothly over a distance. SetViewTargetWithBlend

The math node can be useful but it’s not 100% feature-complete. I have no clue why the input pin for CamLerpRate is not showing for you… Maybe right click it an refresh?

If the goal (achieving the ratio you mentioned) was to produce 2 related values, I’d:

The above would play the Timeline with half the speed and the Delay would trigger after 1s, following the aforementioned pattern. And it would work for other values, too; and every other value in between.

Anyway, you can double click the Math Expression node to peek at the nodes it creates. The worst case scenario is that you may need to recreate the equation with 10 or so nodes instead.

And another way to do it, is to create a data curve and sample it:

• the data you mentioned:

• and sampling it:

Hopefully, one of those can get you close.

Good luck!

I had thought about a curve, just never used one before. It’s definitely easier than the math node. But, got it to work. Gonna mess with the curve, though, haha. Thanks!

Also, Can you submit as an answer so I can credit you?