Download

How to create a spline with multiple points?

Hello,

I try to create a spline deforming a mesh in a blueprint - more specifically in the constructor so that to get it when I drop the BP actor in the editor. I found many topics and tutorials (a good reference is Engine News 6/11 - Engine Source & GitHub - Unreal Engine Forums, another one is the UE4 BP spline examples. For most of them though the modification of the spline, and in particular the addition of new points, has to be done manually, by the user in the editor, and the BP is doing only the mesh deformation or animation.

In my case I would like to add some more points to the spline in the BP and to place the spline meshes right after that to have a deformed mesh on each segment. The thing is I haven’t found a way to add the points in the BP. Whatever I do the result is always a 2 points spline.

Here is the BP. Can you please give me some tips on that? I think I am pretty close from what I want to get with the above graph, I’m sure it is just a node or a connection ahead. I don’t understand why it doesn’t loop on the newly created points though.

Would it be possible to have some quick explaination on why this is not working?

4bdf3d81d5a1b887ba07bc5c30b273c5f83ee453.jpeg

Thank you very much

Werwack

Don’t use the “Set Spline Local Points” node at all; instead, go straight to the ForLoop node. Just make the Spline the root component of the BP… Then, it can be manipulated in-editor, and as you add points in editor the construction script will increase its iterations through the ForLoop to add new SplineMesh components.

Well, thanks for the tip but the thing is I try to do exactly the opposite: I would like to create the points in the constructor so that when I drag and drop the BP in the scene I get a spline component with the number and positions of points set in it. I want to avoid any editor manipulation.

The “Set Spline Local Points” wasn’t there in the tutorial I followed, I added it myself in order to create the new points in the BP.

I had done this before and it works, however for some reason I had to save, compile, then close and reopen the blueprint for the changes to be reflected in the component view.

e3ae21b704b73ee9d53a9200a11281a649a42691.png

edit: Clickling the simulation button in component view also causes it to update

Hi Mosel3y,

Thank you for the tip and the screens. It works, in the way I see the new points and their new position in the component view, and indeed there is a strong refresh problem and I also have to reload the BP.

But worse than that, I don’t see the modifications when I drop the BP into the scene, in the editor view. I only see the basic horizontal 2 points spline :S
Do you have the modifications on you side?

Thank you

I forgot that that had been the case for me as well, but if you use Set Spline World Points instead of local, it seems to work.
I found that when using Set Spline Local points, it actually does work, just that the meshes you add at the spline points or whatever, are offset hugely unless the actor is placed at 0,0,0.

edit: The spline still appears to have only two points though, but if you add a mesh at each point you can see it is working. I don’t know if this is not meant to be used this way, or if it’s just buggy.

I’ve been trying to get this to work for the last two days. It’s a nightmare.

I’m trying to create a tool which will allow me to visually adjust the multiple offsets that control material collection parameters and lay out looped splines that the offsets will travel around during play. Using a custom Blutility event to populate a vector array, which sets spline point locations in the construction script, I managed to create 4 point splines, with points that can be dragged by 3D widgets, that update properly every other frame. As long as you stop dragging at a lucky spot, they will work, but my material will no longer preview in editor, which kinda defeats the point for me.