Hi AlexHakeemStorm
The thing you want is actually basic:
-
Create a new Class child from USplineComponent
-
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); -
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) { UpdateSpline(); }