Quake style lightning gun in blueprint

Hello!

I am trying to recreate a quake style lightning gun/alternate fire link gun weapon in blueprints using UE4.

The way I’m doing it currently is that when the mouse is pressed down, I do a line trace, spawn a beam emitter attached with source to the character and set the target point of the beam to the end of the line trace. I do this within a while loop with a delay of 0.001 seconds. I use a boolean “first shot” to make sure I spawn the emitter attached on the first shot, and on subsequent shots ( mouse button is held down ) i simply update the target location of the beam.

It works sort of all right, but I have two problems that I was wondering if anyone might have an insight that could help me.

The first problem is that the beam seems to “lag” behind the crosshair, I presume this is because of the way that the updating of the target point works. Is there a way to update it that makes it “stick” to where the crosshair is pointed?

The second problem is that when I spawn the beam, the target point is initially set to 0,0,0 so the beam doesn’t start out with the target point I want it to have, is there a way to set the initial target point to a user set point? The way I do it now I spawn an emitter attached, then set the target location, and I presume this is why happens.

If someone has an insight/has done something like this before it is greatly appreciated.

I will post the blueprints if neccessary, and post the solution for others if we manage to solve it ^^

Also, I don’t have many posts, but I am serious about this :slight_smile:

Bump, anyone? :stuck_out_tongue:

EDIT: Solved, I was doing the line trace wrong, using camera controller forward vector, instead of the cameras own forward vector. Seems the one I used first lags behind the others. :slight_smile: