Download

Spline Point Help! for procedural Fences

Hi I have tried practically every procedural spline and instance static mesh tutorial On youtube and while they work I keep having the same issues over and over again and could use some advice.
I Dont want my meshes to be deformed and I want them to be direct lines to each mesh that rotates on the meshs Pivot point EG: the fence post,
But im really struggeling make a BP that automatically does this.

Maybe by automatically placing a spline point at each section length Under each post would work But so far I have not been able to make this happen.
some pics for ref.
First pic is spline mesh
version deforming my meshes.


Second pic is instance static mesh version where I have manually set spline points to linear but it also no behaving correctly like I want :frowning: But this pic highlights how I want it to look and function.

I also found that if I used the bounding box of the meshes for the section size the meshes don’t get close enough to connect correctly. so Im currently using a manual input number.
as you can see I have a bunch of issues.

Questions
How can I make it anatomically place a spline point at the same place under each post??.
How to prevent deforming the meshes?
How to hard code the spline to only create linear point so they are straight and not curved?

I came across this post and its basically the same issue
But the answer didnt really go deep enough on how to do it.

https://answers.unrealengine.com/questions/896644/index.html

Same problem :joy:

I basically just want straight splines like this.
blue =spline
red=spline point
green=mesh


I have been trying to add pline points at each 200cm like I can with meshes but I cant make that work. :frowning:

Hi. To make a fence with a straight meshes and correct corners you have to calculate the tangents properly as well as the amount of spline meshes between the corners so that the mesh ends exactly at the corner. If you want to save time and effort here is an asset that does it all and much more.

Thanks, but Im want to also Sell most of the assets in the pictures On the marketplace As I need to start building up my passive income & I spent a lot of time on them and then typically left them to rot.
Just wanted to add a bit more functionality to the fence panels before I did.

Just thinking out loud, but seems like the most practical way to do something like this, would be to place a point, then look for a place along the spline to place a new point that’s a certain distance from the previous point. Not sure the best way to do this, first thought is to make an array with a bunch of points along a spline, go through the array and find the first point that’s slightly more than the target distance, and place a new point.

Proof of concept, just need to add rotation to it. have to accept there’s a tiny bit of play between pieces or add more samples.

I might be late to the party but what is stopping you from setting point type to Linear after adding a point:

Linear doesn’t set a max distance between spline points, even if it did, I doubt people want to have to place one point at a time to make a fence.

1 Like

Ah I see what you mean, I was late then.

How about snapping points to the multiples of mesh size distance from the last point?

Here’s the blueprint for the example image above

1 Like

Yup, it works, just add a look at for the current vector location and the future vector location, and plug that into the rotation. Had to turn the samples up to 800 for the accuracy to be good enough, but it’s still fast and interactive.

1 Like

excellent reply ZacD :smiley:
is this not performance heavy ?
You are Pro level :slight_smile:

Nah, seems super cheap, placing a few hundred works at very responsive/interactive speeds. Works in 3d space too, so hills are no problem. Although you’ll want to place the pivot as close to the interlocking part as possible if you’re doing a lot of height variation.

Also note that the accuracy needs to be increased as the length increases, since it’s a fixed value. Super high accuracy does add lag.

Here’s the final BP I used btw. Probably plenty of improvements to add, like you could find the bounds of the static mesh instead of using a greater than with a manual input.

quick question for those get nodes, Are you using get copy or get ref?

Im not even going to pretend I understand what I just copied. But its not spawning meshes and Im not sure what I missed.
is the samples var set to zero?

Update: I figured out I need to set an amount of samples :slight_smile:

Question about how to improve accuracy, Like you mentioned as Its pulling a part and overlapping a bit while dragging the spline points. Cant seem to make it really hold to the fence post point.

Hey AlphaWolF, I seem to have found a solution to this problem, you can go to the marketplace download megascans collections.

There’s a blueprint called BP_QuixelSplineWallAlign in it,I think it should solve the problem.

1 Like

WOW, Nice find and thanks for telling me :slight_smile:
I will try this out now!
UPDATE! its a good one But Im not sure how they are preventing the spline mesh components from deforming Like in the above picture as This its still deforming my meshes, And I think the bounding box Issue prevents my meshes getting close enough to look connected :frowning:

On a separate note I have this BP thats almost perfect apart from the fact that its squishing the meshes at each end and Im unable to solve it But I KNOW Its a issue with tangents because if I CHANGE THE CLAMPS to the section length they look ok But just not connecting again.