How to get a value from a runtime float curve (structure)?

Hello,

how can I get a float value from a runtime float curve?

Thank you,

Thilo

Like this:

This is not a “runtime float curve”. It’s a special curve which can be edited in the default value:

Haven’t worked with these. I think the vehicle movement component uses them, not sure if this functionality is directly exposed to blueprints, though.

Unfortunately, you cannot evaluate FRuntimeFloatCurves (or the FRuntimeVectorCurve) in blueprints as of now since the function is not exposed.
If you are able to use C++ however, you can make yourself a function library which exposes them, this is how you evaluate a Runtime Float Curve

.h

/** Evaluates the value of a Runtime Float Curve using the given time. */
UFUNCTION(BlueprintPure, Category = "Math|RuntimeFloatCurve")
	static float GetRuntimeFloatCurveValue(const FRuntimeFloatCurve& InCurve, float InTime);

.cpp

float UMyFunctionLibrary::GetRuntimeFloatCurveValue(const FRuntimeFloatCurve& InCurve, float InTime)
{
	// Evaluate the curve
	return InCurve.GetRichCurveConst()->Eval(InTime);
}

In Blueprints
Screenshot 2022-09-10 100958

4 Likes

Nonsense that such common functionality is not included in the engine