How to make and use a curve in blueprints

Hello.

Maybe the question is not very well written. So let me explain myself.

I am making a car game demo (Think F Zero X) and I am working on the boost for the game. What I want to do is to scale the velocity by a factor that depends on the current velocity of the vehicle. So for example, if you go at 500u/s then when you go over a boost you reach 2400 u/s by simply taking 500 and multiplay the velocity vector by 4. How ever if you reach 3000u/s, then when you use the boost it shouldn’t boost you too much, up to 3300, so a scale factore of 1.1.

This is a paint mock up of the curve I want to make.

I know I can just draw this curve in Excel, find the trend line and apply a function in blueprints. But having a visual timeline/curve that I can edity by itself would make the tweaking process much, much easier.

This is the current blueprint I am using. As you can see, I get the velocity, then find the magnitude (POP POP!) and I can apply another function to find the appropriate scale factor to use.

You can create a curve under miscellaneous in the create dropdown. Also if you have a maximum you could use a clamp to put a limit on the topspeed.

Oh, ok. Any example as to how to use the curve once I create it?

Duncan beat me to it :slight_smile:

Create Curve Float blueprint, inside you can create the same graph

12153-graph.png

then inside your vehicle blueprint make 1 variable CurveFloat, then assign this blueprint in, to use this just call get float and input speed inside.

12154-use+curve.png

@motanum
How did u use the Curve Float in your blueprint for your race game ?

You just add a new Variable with type can be Curve Float, Curve Vector or Curve Linear Color. In this case you would just use a Curve Float! <3

First, create a new variable in your blueprint. Set the type to Curve Float, compile the blueprint, and look at the Default Value panel… you can choose the curve there. Then connect your variable as the Target to the Get Float Value node as shown above

better to use a pure function to get that curve. this way it won’t 24/7 waste RAM on that useless reference.
also do that for everything you can. pure functions are simply better than a reference as long as you need it read-only (const).

I recently found out you can set a timeline’s track curve to a curve asset dynamicaly, pretty powerfull…

Now i also find the 'Make InterpCurve Float/Vector/etc ’ nodes… Where are these used ?

Is there a way to create a curve with this at runtime ?

I see you can add points and tangents to this…
one is a curve object, the other a interp curve struct… any way to create one from the other?

Did you figure out a way to create a curve at runtime? It seems like the InterpCurve float don’t have interpolation functionality in blueprint (they do in C++) and can’t be converted to a regular CurveFloat.