How to add new functionality to the function spline component?

I want to add to the function spline component (Add Spline Point) new features - rotation.
How can I do this?
To create an inherited class from the standard spline component, and to add C++ code?
If I’m right, please give instructions how to do it.
If not, are there some other ways of solving the problem?
Sorry for possible mistakes as English.
Thanks in advance.



Hi AlexHakeemStorm
The thing you want is actually basic:

  1. Create a new Class child from USplineComponent

  2. Because there is not virtual function for such stuff, you will need create a new UFUNCTION method, something like this:

    UFUNCTION(BlueprintCallable, Category = “whatever”)
    void AddSplinePointWithRotation(const FVector& Position, const FRotator& Rotation,ESplineCoordinateSpace::Type CoordinateSpace, bool bUpdateSpline);

  3. now inside your souce cpp you can almost re use the same functionally:

                   const FVector TransformedPosition = (CoordinateSpace == ESplineCoordinateSpace::World) ?
    	ComponentToWorld.InverseTransformPosition(Position) : Position;
    // Add the spline point at the end of the array, adding 1.0 to the current last input key.
    // This continues the former behavior in which spline points had to be separated by an interval of 1.0.
    const float InKey = SplineCurves.Position.Points.Num() ? SplineCurves.Position.Points.Last().InVal + 1.0f : 0.0f;
    SplineCurves.Position.Points.Emplace(InKey, TransformedPosition, FVector::ZeroVector, FVector::ZeroVector, CIM_CurveAuto);
    SplineCurves.Rotation.Points.Emplace(InKey, Rotation, FQuat::Identity, FQuat::Identity, CIM_CurveAuto);
    SplineCurves.Scale.Points.Emplace(InKey, FVector(1.0f), FVector::ZeroVector, FVector::ZeroVector, CIM_CurveAuto);
    if (bLoopPositionOverride)
    	LoopPosition += 1.0f;
    if (bUpdateSpline)

Thanks, I’ll try and write!)