Generating Spline Points In Runtime

Hey guys. I’ve been digging and I’ve found tons of stuff on making splines in the editor, but I’m trying to understand the best way to create a player-made spline. For example, in my game there’s a lot of crafting, and I want the player to be able to lay down a fence that will follow the curvature of the ground. I can’t seem to find anything on how to go about this process, though. I’d really appreciate any suggestions. It doesn’t necessarily have to be perfectly step by step, just something that can give me an understanding of how it might work.

I can figure out how to place the initial spline mesh, but not how to add the points correctly. What I have is a line trace where the initial spline mesh is placed, and then I do another line trace to decide where the end will be. Calculating the points between is my issue. This was what I tried, but to no avail:

I’ve also tried this:

Have you tried doing it all in world space? Get rid of the add and change this to world:

I shall give that a try and report back!

Edit: Unfortunately it doesn’t appear to be changing the spline object.

I just did it like this

For some reason, there’s a huge framerate hit while it figures out where the new point is, but it works:


1 Like

Instead of the debug sphere, would I spawn the spline mesh actor?

Ah, wait, spline mesh. Hold on…

I think I might be missing something somewhere.

I can spawn the initial spline just fine, but I can’t seem to change/add spline points to it.

Basically, the player sets the ‘start’ point, which is where I am spawning the initial spline object, but then I need them to set the end point and have the mesh update accordingly.

like this:

But you have no control over tangent:


1 Like

Ah! That works wonderfully! I’m sure I can tweak it more, now that I understand how to do it. Thank you so much for taking time out of your day to help me with this!


Hello. Quick question about the above answer:

What are you using as a vector parameter for location in your custom event? When I try the above actor blueprint, the mesh doesnt spawn. How is the custom event triggered?

Any help would be greatly appreciated, thanks!

The location is coming from the line trace :slight_smile:

Awesome! I may still be a little confused however. Lets say i have everything in the actor blueprint created except for the custom event. Do you know how to put the line trace as a custom event? I can only get the vector parameter to align with the position and am still pretty green. Any help is greatly appreciated. Thank you!

Standard first person line trace is


I do hope you can help me, Thank you very much for helping the community to solve problems, have a great day.

Hey [ClockworkOcean] this is almost what im looking for, I am spawning a helicopter from a distance, and i want to generate splines from its location to the players location, I cant seem to find anything online besides your post thats even close to the subject.

Can I use this method to generate in real time the path of a bird that takes off from a random spawned location, flies and needs to avoid the landscape xyz ?