How can I get this Cylinder to snake along this spline path.... looking for help or a tutorial

Here is a better example of what I am looking for…maybe you can point me in the direction of a tutorial i can use… I want a spline that curves …i will use this spline as a track…on this track i want to use a cylinder object to be attached to the center over this spline… as the cylinder moves along this track I want it will conform to the tracks bends and curves … basically i want the cylinder to snake along the path… below is a link of what I have done so far

Well, that looks ok, what’s the problem?

Hey @clockworkocean, what i want is for the center of the cylinder to be aligned to the spline, as the spline bends i want the cylinder to bend with it instead of the entire object looking static.

Sorry for the late reply. It works better if you quote :slight_smile:

Updated version:



ezgif.com-gif-maker(1).gif

I tried to crack it last year but failed:

https://forums.unrealengine.com/deve…45#post1752145

Have a look at the anim - you can get a somewhat OK result with approximation. Perhaps if you use more than 3 helper spline points and get clever about calculating tangents, you could pull off a believable result (from afar).

Afaik, there’s no way to do in blueprints.

I take it back. @ClockworkOcean

Is what I did not what the OP means? ( missing the point here… )

I assumed the goal was to *deform *the cylinder snake. As spline mesh components do when you make pipes and such, but dynamic and not only between spline points. [HR][/HR]
One thing I haven’t tried and would probably work really well here is to make the cylinder a procedural mesh. Read spline data -> apply it to the mesh.

Oh, I see. I did not see the animation and image when I posted. That looks spot on.

Out of curiosity - how does it behave with a sharp corner like in the animation in the post I linked to?

It seems to only kink as badly as the actual corner in the spline:

ezgif.com-gif-maker.gif

Not sure why I had trouble implementing this. Not only does it look obvious but also convincing - oh, well. Thank you, gonna take my coat.

I missed it initially also…

Hi ClockworkOcean, this looks exactly like the way I had it looking in 3ds Max(Deform Path Mod.) thank you…How would you or is it possible to have it appear that it’s growing on the spline so instead of it being one length along the track it appears that it grows. At the end of the first run, the entire spline is the shape of the cylinder.

You can move the ends of the cylinder by messing around with the start and end points. I stayed a fixed length of 100 in the example, but you can make the length anything :slight_smile:

Ah, now I remember why this approach will not work! Once this shape gets longer than the distance between spline points, the tangents don’t add up anymore. Or am I to be proven wrong again? Hope I am.

@**TorQueMoD **vid demonstrates the issue well: https://www.youtube.com/watch?v=UJisgq3pUP4&t=3s [HR][/HR]
I then decided to add more SMCs and things get complicated. So I added another spline with extra points, one that glides over the original spline - this way we get to sample more accurate tangents for the SMCs. And it, kind of, works but the results were wonky. At which point I lost hope to get it right.

I still think this can be done with procedural mesh as you get to adjust it at geometry level rather than Start-End points only.
[HR][/HR]
So growing a shape is somewhat easy as you simply add another SMC after each point. But deforming a single long bending shape along a spline is not really that straightforward.

well, logically, There’s only 1 point of the spline being sampled - so if you have an object that’s longer then there could be an issue.

You could get around it by adding multiple objects.

And we can start making another 3030/3330 game.

What if - instead of adding a component you just attach a mesh to the same spline and just move the mesh on the spline?

In that case it doesn’t work, no. But maybe that’s not needed :wink:

Like I say, probably possible with a shader also, and might be easier in that case than the spline…

Precisely. The explanation was not clear. Besides, I should *not *cheer when things don’t work…

You probably meant 2 points. And even you if sampled multiple points, there’s no way of applying the data to a Spline Mesh Component. Admittedly I don’t know know what the component does to the mesh under the hood. Perhaps (almost certainly) the method can be modified.