# Control particle spawn locations from C++ in Niagara

**URL:** <https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985>\
**Category:** FX\
**Tags:** unreal-engine, question, CPP\
**Created:** [July 22, 2018, 10:13am UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985 "2018-07-22T10:13:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BaalSeinOpa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BaalSeinOpa](https://forums.unrealengine.com/u/BaalSeinOpa)\
**Post date:** [July 22, 2018, 10:13am UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/1 "2018-07-22T10:13:34Z")

</div>

I am trying to render a point cloud with specific point locations that I have in a file. I know there are some solutions out there focused on photogrammetry data but I think in my situation I need more control in the end. I believe what I want is a particle system in Niagara where particles spawn at the locations from my file. So I believe I need to do the following:

- Create a particle system and replace the location entry in the particle spawn stack by something that delivers the desired locations
- Looking at the SphereLocation blueprint it appears that I basically need a node that outputs one location (+metadata) from my file per call and wire the output into Particles.Position

Summing that up I need to write this node for producing the locations. In the SphereLocation BP this is (more or less) done by the Gaussian Random Vector node. But that is a Blueprint and I probably want to do this in C++. I am decently skilled in C++ but lack the Unreal experience so here are my questions:

- How do I create such a node in C++?
- Especially, which base class do I need?

Of course, I might be completely on the wrong track here.

---

<div class="post-metadata">

**Author:** ![jgosztyla](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jgosztyla](https://forums.unrealengine.com/u/jgosztyla)\
**Post date:** [September 23, 2018, 9:30pm UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/2 "2018-09-23T21:30:35Z")

</div>

Did you make any progress here? I too want to do something very similar.

thank you,  
0xf00d

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_505aa0131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_505aa0131](https://forums.unrealengine.com/u/anonymous_user_505aa0131)\
**Post date:** [November 9, 2018, 10:20pm UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/3 "2018-11-09T22:20:22Z")

</div>

Having the same question

---

<div class="post-metadata">

**Author:** ![jgosztyla](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jgosztyla](https://forums.unrealengine.com/u/jgosztyla)\
**Post date:** [November 12, 2018, 3:10pm UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/4 "2018-11-12T15:10:08Z")

</div>

I ended up writing a Niagra Data Interface for my point data, and it works in Niagara beautifully. I originally did all the work for the GPU version too, but in the end I just supported CPU. I used the included source code in SideFX as a template for my class.

0xf00d

---

<div class="post-metadata">

**Author:** ![Skan](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/skan/32/493676_2.png) [@Skan](https://forums.unrealengine.com/u/Skan)\
**Post date:** [March 15, 2019, 11:05am UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/5 "2019-03-15T11:05:19Z")

</div>

Cool! Are you planning to release this maybe? Or share some tutorial at least? Would be nice to have a plugin or something, I need something similar (database with tons of points at specific locations), but I’m not that good at C++! 😉

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c7bd6fd8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c7bd6fd8](https://forums.unrealengine.com/u/anonymous_user_c7bd6fd8)\
**Post date:** [August 7, 2019, 6:47pm UTC](https://forums.unrealengine.com/t/control-particle-spawn-locations-from-c-in-niagara/429985/6 "2019-08-07T18:47:02Z")

</div>

I’d also be interested in how you did this!
