# spawning components along dynamic spline

**URL:** <https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759>\
**Category:** Community & Industry Discussion\
**Tags:** add-component, unreal-engine, Spline, runtime, Components, question\
**Created:** [September 22, 2020, 3:38pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759 "2020-09-22T15:38:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 22, 2020, 3:38pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/1 "2020-09-22T15:38:39Z")

</div>

Hey there,  
How can I spawn components (NOT spline mesh components) along a spline component (at each point), spline which is modified dynamically ?  
When using “add staticmesh component” node, it adds one at each spline point on each tick. I want to add only one each spline point, that follows the point when the spline is modified.

---

<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:** [September 22, 2020, 3:48pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/2 "2020-09-22T15:48:50Z")

</div>

Plenty of examples here:

> **[Curve a series of objects](https://forums.unrealengine.com/questions/984273/curve-a-series-of-objects.html)**
>
> Hi all I have a line of objects (screenshot attached). Instead of the objects forming in a line, I want them to curve upward. I have been searching but I can’t seem to find an answer. Is there an efficient way to do this in Unreal, or is something...

Instead of distributing static meshes along a spline, you spawn them at spline points which is actually easier.

> I want to add only one each spline  
> point, that follows the point when the  
> spline is modified.

Components cannot be attached to a spline point per se. When you update the spline, you need to update the components’ positions to match the updated location of the spline points. Also in the link above.

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 22, 2020, 4:06pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/3 "2020-09-22T16:06:01Z")

</div>

Thanks for your link.  
The difference in my case is that the components cannot be generated at construct, since the spline is modified at runtime. It comes from the teleport system of the VR template. The spline is generated by simulating a projectile trajectory and adding points to itself. For now I’ve tried spawning the components when teleport is activated, depending on the number of segments of the spline, but it keeps spawning more and more components…

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 22, 2020, 4:14pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/4 "2020-09-22T16:14:09Z")

</div>

Alright Thanks @Everynone, I finally got it working !  
I made a custom event called when teleport is activated. I have to manually set the number of components I want to place but if works, thanks to the link above. Thanks again !

---

<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:** [September 22, 2020, 4:15pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/5 "2020-09-22T16:15:37Z")

</div>

You could count spline points and spawn that many components.

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 22, 2020, 4:23pm UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/6 "2020-09-22T16:23:35Z")

</div>

Yes I could, but as the number can change at runtime, the components won’t be spawned at new points (or removed from previous points).

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 23, 2020, 7:39am UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/7 "2020-09-23T07:39:54Z")

</div>

I finally found a way to get the spline point numbers and update the components number - I have to store all the components into an array and clear the array each spline points number change.

---

<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:** [September 23, 2020, 8:58am UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/8 "2020-09-23T08:58:30Z")

</div>

Sounds like you’re creating a waypoint system. How close am I?

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 23, 2020, 11:06am UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/9 "2020-09-23T11:06:14Z")

</div>

Not exactly… 🙂  
(and it’s not working properly on the screenshot)

 ![314647-highresscreenshot00012.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/0/d5049963c334c6a049122718eb492c0f104c2beb.jpeg)

---

<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:** [September 23, 2020, 11:11am UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/10 "2020-09-23T11:11:18Z")

</div>

I see, virtual pillaging and such. Good luck!

---

<div class="post-metadata">

**Author:** ![Teapot\_Creation](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Teapot\_Creation](https://forums.unrealengine.com/u/Teapot_Creation)\
**Post date:** [September 23, 2020, 11:21am UTC](https://forums.unrealengine.com/t/spawning-components-along-dynamic-spline/471759/11 "2020-09-23T11:21:36Z")

</div>

Thanks a lot !
