Static mesh array on path with random objects from selection- runtime

What I want to make is a path (as shown n the image) made up of small segments (image - C) picked at random out of a group of objects (say 10 objects in this group) (image - D).
As the player moves, this path is generated below its feet, so say for every 1 meter the character moves, a new piece is spawned out of the array.
The pieces themselves stay where they were placed, so in other words the path itself doesn’t follow the player.
So what you would see (from another person’s perspective) is this path or trail that is made behind a player (image - B), that follows the path the player took.

  • Movement : left/right and up/down
  • extra: if this would be possible to implement, i would like to make it so that the mesh warps a little to accommodate for the curve, if possible.
  • it needs to be runtime, so add spline mesh procedurally BP’s in the construction is not what i’m looking for.

I would like to add that have a basic understanding of UE4, and I am looking for some advice and would like to be shown into the right direction, say a page out of the ue4 docs so I have a start.
I would really appreciate any help I can get!

it needs to be runtime, so add spline
mesh procedurally BP’s in the
construction is not what i’m looking
for

Add spline meshes procedurally run-time then, sounds like a perfect tool for this.

Essentially this:

Image from Gyazo

Things to improve:

  • limit and recycle the SMCs for better performance
  • improve the tangents by recalculating all SMCs (or at least the last 3-4)
  • add random meshes

Looks like this should work ok.

Hi, thanks for the fast response. However, it would be a great help if you could show/share a bit more information as to how you got it to work. It seems like a good base for what I need indeed.

I copied your nodes into my character controller, and in the standard first person controller and both game me the same error whilst playing.
’ level:persistentlevel.playercontroller_C.CollisionCylinder is not static (in blueprint ’ player contoller’) cannot attach SplineMesh, which is static to it. Aborting.

You put the nodes in the player contoller, right?
And besides the Vector variable and the spline mesh component, did you add anything else?

Thanks again for the help!

And besides the
Vector variable and the spline mesh
component, did you add anything else?

I imported a mesh for the spline and made a material for it. But I believe you have it covered already, judging by the attached image.

It’s all in the character blueprint but it can be placed anywhere, really. The spline is set to Movable, its Rotation and Location are set to World Type - while it’s a part of the character, it inherits neither rotation or location.

312181-annotation-2020-09-02-134624.jpg

And, of course, you need to choose a mesh when you add SMCs. Do note the Manual Attachment tickbox.

Got it to work, that got me a nice base to start working with. Thanks for taking the time to explain with details!

Yes, I hope i can get my models to work nicely. If you want, I could share the end result.

It would be really nice to see. Please do!