Creating Points along spline automatically via blueprint

Hi there,

Im running against a wall here. I am currently working on a blueprint for a wooden bridge that can be increased in length.
I have figured out most of it and it already kinda works. But my problem is that the splinemeshes only look right if i use number of points and not spline length and divide it.
So my question is. Is there any way to create new points on a spline via automatic interpolation so that i can control it via variable?

The idea is that i only want to place 3 points for easy control but can get inbetween points so that the splinemesh isnt teared all over the place. As mentioned i already tried to do that with the location and tanget along distance node but the stretching of the mesh gets really messed up and i have no control over it it whatsoever. Im really bad at visual scripting and i searched all over the internet to get some information. But all the tutorials and documentations i found only cover the basics. Sorry for the long text i hope someone can help me on this one. I’d really appreciate that.

Thanks in advance and cheers guys.

Working with a spline this way is a little more complicated than one might expect; but not much. When you place a spline you have two points. When you add points, they go on the end and not in the middle. So you have to do the work to figure out where all the points should be then clear the points and place them back in order. I think this is the best way. So this setup is for two points you would be controlling for the layout…but you can modify it for more. You could also determine how many points to place off of the length and so on.

NOTE:Points added in the construction script will not show up like those that are dragged and placed. I explained the process below but will do a quick video to show the setup.

First, in your construction script, create the following local variables. VectorArray:PointLocation, VectorArray:PointTangent, and Float:DistanceBetweenPoints.

Next, Create a variable int:NumberOfBetweenPoints.

The first thing we will do in the construction script is set the local var Float:DistanceBetweenPoints. Divide the spline length by int:NumberOfBetweenPoints +1 (1 extra for the last point) to get this value.

Next do a for loop starting at zero and ending with int:NumberOfBetweenPoints +1. Then add an element to the VectorArray:PointLocation and VectorArray:PointTangent by getting the location and tangent at distance along spline. Distance will be the array index * Float:DistanceBetweenPoints. This is all using local space.

This will provide you with two arrays with all the proper points and tangents need to place each point in order.

Now clear spline points. This will remove all the points. Next do a for loop starting at zero and ending with int:NumberOfBetweenPoints +1. Add spline point and get loop index VectorArray:PointLocation to set location. Then set spline tangent using the index to get the proper VectorArray:PointTangent.

Finally, with another for loop starting at 0 and ending with spline->numberofsplinepoints-1. Add a spline mesh component and set the start and end by getting the location and tangent at spline point for the array index(start) and array index+1(end).

1 Like

Thank you so much kind sir. I will try it out later today and will report back if it works.

the :smiley: is suppose to be : and then the letter D for Distance.


The BP should look something like this