Download

[Help] Emitting GPU Particles along spline component?

Hi Guys, I’m trying to make particles move along spline or path… Want them to travel along the spline component from point A to B to C …
I tried doing that with vector fields but sometimes it won’t work at all or it’s not really accurate, I could make the emitter move along the spline with the help of Content Examples, But it’s not really what I want…
should this be done with blueprints or the particle emitter it self?.. any thoughts?

any ideas? :frowning:

IN the content examples there is one example exactly about that, just Im not in my computer right now to give the specifics, but if you have it, check it out.

Hey in case you never found your answer I think this is what tyoc213 was on about https://www.youtube.com/watch?v=ywd3lFOuMV8

I’m not sure it’s possible to move GPU particles along a spline component, because the spline is CPU side. But, it is possible to construct a spline in a material, which can be used to offset the world position of a particle, based on its relative time, and control the spline points through blueprints via a material collection parameter or a dynamic material instance.

In the material editor, there is a node called GenerateASpline. The Catmull-Rom spline it produces relies on 4 control points, and generates a curve between the 2nd and 3rd point. The spline can be extended with additional splines where the 2nd, 3rd and 4th points of a given spline are the 1st, 2nd and 3rd points of the next spline. For this example, I created a material collection parameter with 8 vector parameters, to produce an extended spline composed of 5 segments, with 6 points on the curve.

Heres the code from custom1

float t=0.0;
if (x<0.2){
t=x*5.0;}
else if(x>=0.2 && x<0.4){
t=(x-0.2)*5.0;}
else if(x>=0.4 && x<0.6){
t=(x-0.4)*5.0;}
else if(x>=0.6 && x<0.8){
t=(x-0.6)*5.0;}
else {
t=(x-0.8)*5.0;}
return t;

and from Custom2:

float3 s=(0,0,0);
if (x<0.2){
s=s0;}
else if(x>=0.2 && x<0.4){
s=s1;}
else if(x>=0.4 && x<0.6){
s=s2;}
else if(x>=0.6 && x<0.8){
s=s3;}
else {
s=s4;}
return s;

The particle system is a component of a BP which sets these parameters on construction, and manipulated with 3D widgets, though it’s certainly possible to animate the control points by setting the parameters each tick. Here, the particles have a velocity distribution of -10 through 10 in each direction, which is why they spread out the further they move along the spline. With a velocity of 0 they follow the spline perfectly.

This worked great, thank you! I’d like to have my particles align with the spline as they move across it. Because they’re only moving based on the expressions in the custom scripts, there’s no velocity to work with. Any idea on how to accomplish this?

This worked perfectly for me, thank you so much. I just would like to know if there’s any way to slow the particles down? Mine are running way too fast and I can’t figure out how to adjust that.

This actually doesn’t run along the spline at play time, it only generates a particle at the blueprint transform. Any idea on how to fix this?