Best Workflow for generate a railing with different meshes (UE4)

Hey everybody,
Working with UE4.26 at the moment (should also be interesting for all versions with instanced meshes). I try different workflows for level building. I have a nooby question about instanced Meshes and how to get the float value of each mesh in an array.
I want to generate a railing with randomized static mesh instances within a BP.
I would recreate it with a spline after I get this one resolved :slight_smile:

No problem with the same sized mesh:

Generate Array

Randomized Add instance with same sized Mesh (now, old broken, aso.)

It breaks If I want to use meshes with different sizes/lengths for the railing:

-Made an Array with 2 SM (short 100cm, Long 300cm)
-Middle Mesh is Random (Array Item from Stream) Instance Mesh
-BP creates a railing with a gap of 200cm (short) or is clipping in the next mesh instance (long)
-First and Last Mesh can be set by me (optional)

How could I get the Mesh Item for each Loop and change the Y Location accordingly, to make it fit the last random mesh?

You adding an ISM for every mesh. The whole point of ISMs is, you only need one for each kind of mesh. In your example, you would have 2 ISMs, one for the short railing, and one for the long. There would be two instances of the short.

In any event, you need to move the mesh placement along by the length of the mesh just added. Little bit of a pain in bum.

It’s probably easier to just use AddStaticMeshComponent, because unless your fences are going to be thousands of meshes long, you won’t see any benefit from instancing :wink:

Also, while you’re at it, you might as well do it on a spline. That way, you fence can go all over the place, and it’s not much more hassle :wink: