Spawn emitter along a line

My sword swing is incredibly fast, moving so fast that the Niagara system has no chance to spawn particles (it happens in 2 or 3 frames); so it depends on the player’s FPS. Is there a method to generate particles between two points?

Usualy for these cases almost everyone use a baked mesh like this:

You can either use actual mesh trails, or ribbons for this. Meshes look usally better, but need to be hand crafted for each ‘slash’. Ribbons are a more procedural approach.
Mesh method:
VFExtra from Niels Dewitte has a meshe generator included. With this you can create exactly these kinds of meshes. Some people call those soulercoasters, some call them weapon trail etc. different terms, same thing. Or you use Houdini, as posted above.

Ribbons method:
Make sure the ribbons stay attached properly:

Ribbons sword trail setup:

1 Like

While the mesh method is a valuable suggestion, it falls short in this scenario as the swords pass through the wall, and I am specifically looking for sparks and surface effects upon the surface. If we use the mesh approach, When the sword goes through the wall, the effect will not be visible to the player. My goal is to replicate the situation when the sword hits walls or objects.

Ah sorry, misunderstood your original question.
In theory you do this with some sort of collision detection, then use the collision impact location to spawn your particls.
For example, when doing sword swipes, you do line traces along the length of your sword.
As soon as the line trace hits the wall, you feed this position into your Niagara system as your spawn location. This should give you at least some sparks at the right location.
To further improve this, you could spawn sparks all along the length of your sword (once you have the impact location of sword and wall). Then you move all those particles forward (in the direction of the sword arc), within one frame (or preferably on Particle Spawn), and add Distance Field Collision to them, or ‘Snap to distance Fields’, if you can use distance fields. This way, the particles should all roughly go to the location of where the sword is impacting the wall.
Considering how fast your sword swipe is though, you can also pre-trace the sword swipe (as I assume it will always be the same anim), offline, so to speak.Then you save the data of the locations, which you would need to trace, for each sword swipe. Then do all of those line traces at the same time the sword swipe is happening. You will get multiple intersection locations then, from the traces (wich follow the arc of the sword). If you spawn particles from those,this should be more accurate, at least visually.
It will be more expensive though, it will scale with the number of traces.

Thanks for the replay. for now, I write a code base on the frame rate and surface spawn Niagara system along a surface, this is not what I am satisfied but it works for now, but can you explain more about pre-trace? it’s the first time I hear it.

You basically play the animation in slow motion (it will interpolate between frames), or render out the anim with a higher framerate from your 3d tool. Then once you play it in slow motion, you trace along the animation, e.g. you trace the grip & tip of your sword. Then you write all these locations into arrays.
Once you have traced the entire animation, you can then use these arrays to do your actual line traces (from grip to tip). This should give you more accurate results. And it’s also flexible, as you can adjust how many traces you want (how high the accuracy should be).

You could also just make the sword an actor, attach it to the hand, and apply a collision volume to the sword’s blade and listen for collisions. You can then get the XYZ of the collision location and the normal of the impact and use that to spawn the system for the impact fx. You could then send a notify on collision to kill the swipe/trail fx. The trail would stop on and die on impact.

Depends on how you do the swipes though. The cheap and common way is like the method Un1horn posted, where it’s basically just an arc that plays at the apex of a swipe. I typically use a full ring mesh and then offset the material UVs over the life of the particle, so they feel more like they are following the path of the swipe. That method would allow you to see some of the swipe before the sword passes through the wall and the fx die.