Spawn niagara from line trace

Hello, I am relatively new to development in unreal and have been using tutorials for guidance. I have found ways to make a niagara system and to make a line tracing gun for combat systems.

I have expanded from the basic first person shooter template and now I am looking to fire a beam from my gun every time I shoot. How can I make it so that my niagara system actually shows up when I use the gun?

(the attached screenshot is a snippet of my blueprint where I have tried to add the spawning of the niagara system, it does not spawn the system though)

Hey @BigDonnyCalTTV

I recommend to follow this tutorial.

Before I watch all 40 minutes of this, I noticed it says it is for a laser sight (which I imagine is permanently displayed). I want to clarify I am looking to display a bullet effect and not a sight, this video will still help for a bullet?

Yes! It will work mostly the same.
The only change you will need is to validate if the laser is hitting something.

If it is mostly instantaneous you can validate with the Raycast test.

If you want something more complex where the Laser is not instantaneous. You may need to calculate manually the “distance” of the ray.
You can do other things like heat up the laser too. Let me know I can give you more assistance in that way.

I have followed the guide to get this code. Of course in the guide the guy uses a constant beam to be activated while aiming with right mouse click whereas I want it to fire off a laser on left click when shooting (was hoping to add to my shooting code in the weapon blueprint but I could not get a reference to the niagara system so I did this in the first person character blueprint).

I have a couple issues:
-The beam goes off to the left side instead of straight ahead
-The beam only activates if I hold the mouse button down for a second (I want it to appear when it is clicked as I am using this to emulate a bullet)
-The beam remains for a few seconds after being activated (I want it to disappear when I am no longer pressing the left mouse button)

Any advice would be greatly appreciated. If it helps, my vision for this is to launch a single laser shot everytime the gun is fired (it is not a weapon where you hold down the mouse button to fire a continuous beam that will keep ticking for damage).

  • The beam goes off to the left side instead of straight ahead
    I see you are using the right vector instead of the forward vector could be that the issue?

-The beam only activates if I hold the mouse button down for a second (I want it to appear when it is clicked as I am using this to emulate a bullet)
-The beam remains for a few seconds after being activated (I want it to disappear when I am no longer pressing the left mouse button)

I reccomend not only disable the niagara component but also set the render in false or true if is needed.

Apologies I am a little confused by your suggestion here, any chance you could rephrase this?

I should mention I added in the forward vector instead of right vector and added in rendering enabled nodes to where I am guessing it should go but there is still no sign of the effect.