Trying to implement niagara vfx to weapon to make lasergun.

Hi, i am new to unreal and have been trying to figure out how to add Niagara effects to the firstpersoncharacter blueprint in ue4. A lot of the tutorials have a function in them called (GetPlayerViewPoint) and i don’t know what to put in this function it seems to be so common in tutorials that i thought it was a default thing, but if it is i can’t find what version to download to find it.

This is the tutorial i am following, any help would be greatly appreciated. If possible please make the instructions as simple as possible and in blueprints because i don’t know any c++ Thanks.

Hey there @Laughing_Doood! Welcome to the community! Are you trying to get the player camera location? I could take a look at your blueprint if you’d like!

If you’re just looking for a good tutorial, this one is quite nice for a basic Niagara based laser.

Disclaimer: One or more of these links are unaffiliated with Epic Games. Epic Games is not liable for anything that may occur outside of this Unreal Engine domain. Please exercise your best judgment when following links outside of the forums.

Hi @SupportiveEntity , thanks for the link and the welcome, i just realised i didn’t link the tutorial i was following. I am looking to figure out what to use for the getplayerviewpoint function used in the first person blueprint and then pasted into laser bp and used. This part is at 16.16 in the video.

this is the video it’s by rimaye

I will watch the video you linked thanks.

the below images are what i have set up atm, this spawns a laser that can turn off like the video but the issue then is that the beam comes from the front of the gun but doesn’t follow the crosshair. It just spawns out of the gun and stays at that angle. so if i face the floor the beam is still going from that point and looks weird.




From the looks of things, your line trace seems to be a bit off. So first thing I’m going to recommend is to turn on your line traces’ debug draw so you can verify it’s going the right way. I don’t believe it is, a little weird that they had you go through a whole Dotproduct and everything for what you could just extract from the camera position. An example I have is a trace from the front of your gun to where you’re looking. (The cast point it references is just a transform on the end of the gun, you could use the muzzle socket or whatever you’d like as the offset).

Thanks for the help, I have used line trace once or twice. But it’s like every time I try to do something new it’s done in a different way, so I didn’t think much of it (and of course I forgot to try debug draw). I am away from home for a few days but i will try that as soon as I get back I really appreciate the help and I have my fingers crossed it will work.

It doesn’t help that I have been using ue5 since starting a few months ago and a lot of the tutorials are ue4 so I thought for this it would be easier to use ue4 then move it over to 5, only to realize that even the firstperson blueprint is split up so things are more complicated.

I’m assuming I replace the area in the bp that has line trace with this and then attach the Niagara vfx to the nozzle of the fp gun?

You’ve got the gist, basically the math from the muzzle just extends. Once it’s pointing where the gun’s pointing we’re good. Manipulating it once your trace vector math is correct will be much easier. I tend to use camera position however not always directly from the trace point. This is just because of the “head glitch” rule of if the player can see it they want to be able to shoot it.

I managed to make it work!! Thanks for all your help, i feel a small bit more confident in using line trace now. Niagara on the other hand is a pain :smile: . Now onto the next thing to feel lost in. And sorry for the late response i was swamped when i got back.