# Is there a way to spawn Niagara particles within a closed loop spline area?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-spawn-niagara-particles-within-a-closed-loop-spline-area/462403>\
**Category:** FX\
**Tags:** spawn, unreal-engine, Spline, question\
**Created:** [March 12, 2020, 9:43pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-spawn-niagara-particles-within-a-closed-loop-spline-area/462403 "2020-03-12T21:43:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CocOnUtRKR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CocOnUtRKR](https://forums.unrealengine.com/u/CocOnUtRKR)\
**Post date:** [March 12, 2020, 9:43pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-spawn-niagara-particles-within-a-closed-loop-spline-area/462403/1 "2020-03-12T21:43:15Z")

</div>

![297760-spline-area-spawn.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/5/8/658e893db0e1e301ced727b70d40881ba25a18cf.png)

I’m trying to spawn particles inside the area of a closed loop spline… Is this possible, and how?

---

<div class="post-metadata">

**Author:** ![Deathrey](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Deathrey](https://forums.unrealengine.com/u/Deathrey)\
**Post date:** [March 14, 2020, 12:55am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-spawn-niagara-particles-within-a-closed-loop-spline-area/462403/2 "2020-03-14T00:55:45Z")

</div>

There are many ways to do that. Here is one of it:

Get bounding box of the shape.  
On particle spawn, generate random position within that box and set it as particle position  
Take spline segment, and a ray in any direction in the plane of said spline. Intersect ray with spline segment.  
Repeat for all segments.  
If number of total intersections you received is even or zero, kill the particle.  
Keep the particle otherwise.
