How to use FRuntimeFloatCurve

I’m trying to use a FRuntimeFloatCurve. I’ve defined the custom property in my USTRUCT as follows:

USTRUCT()
struct PROJECT_API FAnimNode_SPW : public FAnimNode_SkeletalControlBase
{
	GENERATED_BODY()

public:
	UPROPERTY(EditAnywhere, AdvancedDisplay, Category = "Character")
	FRuntimeFloatCurve MyCurve;

	// Constructor
	FAnimNode_SPW();

The constructor:

FAnimNode_SPW::FAnimNode_SPW() : Super()
, MyCurve()
{
}

I can then draw my curve in editor as I wish, by adding keys and modifying the tangents. However, I don’t seem to be able to retrieve the defined values at runtime:

// this is an empty array
MyCurve.GetRichCurve()->Keys
// this is always 0.f (even though the curve is defined to never go to 0)
MyCurve.GetRichCurve()->Eval(0.7f);

Any kind soul knows what I am doing wrong?

Thank you,
r.

To add to this: I’ve checked the code in WheeledVehicleMovementComponent4W and I don’t see anything specifically different, though in Editor the component’s property appears as follows:

image

While in my code it appears as so:

image

You see that when you click on the expanding triangle that there is this extra ability to select / apply / create an external curve in there?

Anim nodes are a bit of a special case, it’s possible the property isn’t being treated correctly by the anim BP compiler. I’m not sure how you’d fully solve that, but using a curve asset and evaluating that instead should work.

The UI looks different because the wheeled component customizes its details view UI. See WheeledVehicleMovementComponent4WDetails.cpp.

Oh I see, thank you. Pity. :slight_smile: