Hi beautiful people of internet and UE!
I’ve got a question related to splines in UE4.
I would like to add spline points using coordinates through C++ code, but I’ve found nothing about it on the internet. Any answer is welcome.
Thank you in advance!
eldany.uy
(eldany.uy)
June 8, 2022, 11:06am
2
this?
USplineComponent* mySpline = CreateDefaultSubobject<USplineComponent>("MySpline",true);
FSplinePoint myPoint;
myPoint.Position = FVector(0.0f,0.0f,0.0f);
myPoint.Rotation = FRotator(0.0f,0.0f,0.0f);
myPoint.Scale = FVector(0.0f,0.0f,0.0f);
mySpline->AddPoint(myPoint,true);
#include "Components/SplineComponent.h"
Thank you very much!
I think I might have been not totally accurate about my problem. I would like to define the points of ONE spline using coordinates in C++ code. Is it possible?
eldany.uy
(eldany.uy)
June 10, 2022, 12:08pm
4
you have a bunch of functions in the SplineComponent Class for anything you want to do:
USplineComponent | Unreal Engine Documentation .
if you want to get the #of points in your spline: GetNumberOfSplinePoints()
move a point of the spline: SetLocationAtSplinePoint()
add point: AddPint()
Get a position in any point of the spline (from 0 to 1) GetWorldLocationAtTime()
etc