Get Float Value from Curve in C++

Hi,

I often use FloatCurve or VectorCurve with a GetFloatValue node to obtain non-linear value based on another float value.

Im using these in tandem with a lot of calculation to generate rotations and positions for meshes and actors in my blueprints.

Is there a way to access a curve asset and do the same thing GetFloatValue does but in C++?

It seems that performance for heavy mathematical calculations would be better in C++ class.

Thanks for any help :o)

Here you go call this in header

UPROPERTY(EditDefaultsOnly, Category = Curve)
UCurveFloat* Curve;

Make a curve blueprint in project and assign to this variable and use this in cpp

Curve->GetFloatValue(DeltaSeconds)

you can change DeltaSeconds to any value of your curve X-Axis.

1 Like

Sweet … thanks

It seems that the GetFloatValue function can’t be accessed in my own Pawn class now in 4.20.3… Is there any way to solve it?