Download

How to draw smooth curve using Spline at runtime

Hi, guys!

I’m trying to create a drawing application, and I want to draw a smooth curve in response to user input.
In my approach, I use Splines and Spline Mesh to represent the curves.
If we needed to extend a spline curve, we would add a new Spline Point and a Spline Mesh to the end of the Spline.
My blueprint script is like this. This Add Point to Spline function is called according to the user’s input point.

41040720eff07c34c843bf1d88db1d2b889d25f0.png

However, the results were not what I expected and the curves did not connect smoothly.

Result.png
https://forums.unrealengine.com/core/image/gif;base64

I want to do this at runtime with low overhead, not in Construction Script.
Does anyone have any good tips?

Use SetSplinePointType and try the different options. You probably want Curve, but give them all a shot. If you need finer control, try out SetTangentAtSplinePoint.

Also, ensure the meshes you use have some polygons to spare so they can actually bend. You cannot bend a cylinder with no internal rings.

Hi Jared and Everynone,

Thank you for your quick reply.
I modified it as your advices and got the results I expected.
What I’ve done is

  1. I used SetSplinePointType to specify a Curve Custom Tangent type for the newly added spline point.
  2. Using the DCC tool, I made some cuts in the polygon model of the cylinder.

It was a great help! Many thanks!

Blueprints:

58b912f1b1428e9ea56d823d59a7bbfd31f29e04.png
https://forums.unrealengine.com/core/image/gif;base64

Result:

Result_1.0.png