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

**URL:** <https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106>\
**Category:** World Creation\
**Tags:** unreal-engine, Spline\
**Created:** [March 27, 2021, 10:45pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106 "2021-03-27T22:45:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajharding1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajharding1](https://forums.unrealengine.com/u/ajharding1)\
**Post date:** [March 27, 2021, 10:45pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/1 "2021-03-27T22:45:02Z")

</div>

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

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/b/95baabaa12056fc3bd6a4cdd6a38b2563c1d6f21.jpeg "spline") ](https://www.youtube.com/watch?v=AmCtVt151T0)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 28, 2021, 7:44pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/2 "2021-03-28T19:44:42Z")

</div>

> [@ajharding1](#):
>
> 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
> 
> [https://youtu.be/AmCtVt151T0](https://youtu.be/AmCtVt151T0)

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

---

<div class="post-metadata">

**Author:** ![ajharding1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajharding1](https://forums.unrealengine.com/u/ajharding1)\
**Post date:** [March 29, 2021, 2:29am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/3 "2021-03-29T02:29:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 30, 2021, 12:21pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/4 "2021-03-30T12:21:21Z")

</div>

> [@ajharding1](#):
>
> 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 🙂

Updated version:

 ![Screenshot_4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/5/055e86ec4569cf78dc4dd5e45129245d4103735b.jpeg)  
 ![Screenshot_5.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/f/0ff4efaea4ce16151a23195047da61e086a45004.jpeg)  
 ![ezgif.com-gif-maker(1).gif](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/4/5432b6ac177602ae9a1e60cb1899171b9d9729ca.gif)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 30, 2021, 2:44pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/5 "2021-03-30T14:44:59Z")

</div>

I tried to crack it last year but failed:

[https://forums.unrealengine.com/deve…45#post1752145](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1750975-deform-and-move-mesh-along-spline?p=1752145#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](https://forums.unrealengine.com/member/2243586-clockworkocean)**

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 31, 2021, 12:06pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/6 "2021-03-31T12:06:19Z")

</div>

> [@Everynone](#):
>
> I tried to crack it last year but failed:
> 
> [https://forums.unrealengine.com/deve…45#post1752145](https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1750975-deform-and-move-mesh-along-spline?p=1752145#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.

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 31, 2021, 12:29pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/7 "2021-03-31T12:29:43Z")

</div>

> [@](#):
>
> **to snake along**

> [@](#):
>
> the cylinder moves along this track I want it will conform to the tracks bends and curves

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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 31, 2021, 12:32pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/8 "2021-03-31T12:32:39Z")

</div>

> [@](#):
>
> Is what I did not what the OP means? ( missing the point here… )

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 31, 2021, 12:40pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/9 "2021-03-31T12:40:46Z")

</div>

> [@](#):
>
> Updated version:

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

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 31, 2021, 1:04pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/10 "2021-03-31T13:04:16Z")

</div>

> [@Everynone](#):
>
> 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](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/8/58f75e184c10028a54f4c0c7eab74759063dabde.gif)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 31, 2021, 1:18pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/11 "2021-03-31T13:18:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 31, 2021, 1:26pm UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/12 "2021-03-31T13:26:52Z")

</div>

> [@Everynone](#):
>
> 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…

---

<div class="post-metadata">

**Author:** ![ajharding1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajharding1](https://forums.unrealengine.com/u/ajharding1)\
**Post date:** [April 2, 2021, 5:55am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/13 "2021-04-02T05:55:33Z")

</div>

> [@ClockworkOcean](#):
>
> Sorry for the late reply. It works better if you quote 🙂
> 
> Updated version:
> 
> ![Screenshot_4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/5/055e86ec4569cf78dc4dd5e45129245d4103735b.jpeg)  
> ![Screenshot_5.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/f/0ff4efaea4ce16151a23195047da61e086a45004.jpeg)  
> ![ezgif.com-gif-maker(1).gif](https://d3kjluh73b9h9o.cloudfront.net/original/3X/5/4/5432b6ac177602ae9a1e60cb1899171b9d9729ca.gif)

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.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 2, 2021, 8:58am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/14 "2021-04-02T08:58:32Z")

</div>

> [@ajharding1](#):
>
> 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 🙂

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 2, 2021, 9:03am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/15 "2021-04-02T09:03:29Z")

</div>

> [@ClockworkOcean](#):
>
> 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 🙂

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](https://forums.unrealengine.com/member/11830-torquemod) \*\*vid demonstrates the issue well: [https://www.youtube.com/watch?v=UJisgq3pUP4&t=3s](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.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [April 2, 2021, 9:12am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/16 "2021-04-02T09:12:16Z")

</div>

> [@Everynone](#):
>
> 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.

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?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 2, 2021, 9:14am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/17 "2021-04-02T09:14:23Z")

</div>

> [@Everynone](#):
>
> 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](https://forums.unrealengine.com/member/11830-torquemod) \*\*vid demonstrates the issue well: [https://www.youtube.com/watch?v=UJisgq3pUP4&t=3s](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.

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

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 2, 2021, 9:15am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/18 "2021-04-02T09:15:42Z")

</div>

> [@Everynone](#):
>
> 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](https://forums.unrealengine.com/member/11830-torquemod) \*\*vid demonstrates the issue well: [https://www.youtube.com/watch?v=UJisgq3pUP4&t=3s](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.

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 2, 2021, 9:18am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/19 "2021-04-02T09:18:05Z")

</div>

> [@ClockworkOcean](#):
>
> 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…

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 2, 2021, 9:20am UTC](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106/20 "2021-04-02T09:20:54Z")

</div>

> [@MostHost\_LA](#):
>
> 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 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.

[Next page](https://forums.unrealengine.com/t/how-can-i-get-this-cylinder-to-snake-along-this-spline-path-looking-for-help-or-a-tutorial/211106.md?page=2)
