Get spline mesh components location

How do I get the location of the spline mesh components? (not Landscape spline)

I want to be able to place a spline in the world and populate meshes along it, and then have the option to snap those meshes to the landscape. I am planning to do a line trace from each mesh down (or up) to the landscape, and the hit-location z value will be the new mesh z location.

But I don’t know how I can get the meshes to then be able to get the position.

I have done this, but it will only get the position of one of them:

Update:

This is how I got the position at the start of the meshes

However, I don’t seem to be able to update the position of the meshes. Any idea how I could do this?

Hi there @XxpiingyxX,

There’s likely a better way for you to be handling your spline meshes.

The main body of any spline tool contains a loop where you spawn your individual mesh component either at location or at distance along the spline. At the most basic level, something like this:

In order to make changes to individual spline mesh components, you should save all existing components to an array so you have easy access to them in the future.

Your method of finding the locations is valid, but with this new method, it’ll be much simpler.

The great thing about this method is since the array is being set on creation, the indexes will always be associated with their order along the spline, so it’s very easy to look these up again in the future. With this new logic, this is what your line trace might look like instead:

If you need to save and retrieve any other custom values associated with your mesh order, as long as your arrays are created within the original loop, you can retrieve them later by index:

Best of luck! Let me know if you need any more help.

Thank you, but this doesn’t work for me and I am so confused about it.

This part (where I add the spline mesh component worked for like 2minutes until I added the line trace. Now none of it works.



All of it:

So as mentioned, the adding of the spline mesh component worked right until I added the line trace and set the world location. But now none of it works. I even removed the line trace again, but the first part still doesn’t work.

I have double checked that the SectionLenght isn’t 0, and the Interger into the forLoop is set to 100-somthing. I also checked so the Array is not empty.

This is how I do it for my instanced static meshes that’s placed along the spline, which works perfectly.
But I would like to do it with a spline mesh component because I feel like that’s “deforming” better when creating fences.

As a workaround, I created a Utility BP that snaps the whole spline to the landscape, instead of only the meshes:

And I had to create a new project for the spline mesh component to work.

Sorry for spamming my own thread, but I found the solution and wanted to share it if anyone else struggles.

I realized I could snap the spline to the landscape in the spline BP too. I therefore added this function, which I call before spawning the meshes on the spline.