I am trying to make a top down space shooter, and i want to create a laser that draws from the ship to the cursor location, but if the ship travels at high speed i can notice that the laser is lagging behind the ship 1 frame: UE4 Lag - YouTube
I tried using draw debug lines, it showed the same lag. Can anyone help me on what i’m doing wrong?
I already tried setting that on my ship actor, and it didn’t do anything, and my beam is just a particle system component in my ship actor. I should have everything pictured related to the actor in the imgur link.
If I’m not mistaken it has nothing to do with you doing something wrong but rather the default settings.
You are updating the start / end position of that beam in one your blueprints, right? Access its Class Defaults and find Actor Tick tab in the panel. You can expand it to reveal the advanced panel:
Set Tick Group to Post Update Work, see if it helps.
I still couldn’t figure out what is causing it, but it might be that my movement is based on add impulse. Is there anything similar that i could use for 0G ship movement?
With the ship driving the beam movement none of the TickGroups do the trick?
Nope, none of them did anything.
I think the problem is with the particle system, because now i tried it out with an AddActorWorldOffset movement scheme and the start of the laser stays on the ship, but the end of the laser is still lagging behind 1 frame from the cursor, but i am updating its position the same way i am updating my decal crosshair’s, and that is not lagging behind.
You can set the Tick Group of the beam itself once created in blueprint. Pull from it and choose to Set Tick Group. You may have to promote it to a variable first, but don’t think so. Set it to Post Update Work as Everynone said and as long as it’s bound to a component the lag is gone.
In case anyone else comes looking for a solution.