Laser beam that locks and follows a target

Hello great people from the Unreal forums,

What i’m trying to do: A beam/laser that follows, starting from a turret and ending at its target.
A good example of what I’m trying to achieve can be seen looking at a Starcraft 2 unit… The VoidRay !

(You can find some videos of how it behaves easily. Or you can clic here.)

I followed these tutorials: Making A Laser In The Unreal Engine Part 2 - YouTube
(It has multiple parts)

I’m not a big fan of using an “Event tick” but at the moment, I’m ok with that because… I just want it to work.

Here’s what I’ve got so far.

We set a system where when an enemy overlaps a collision box, it triggers an event that makes it take damage while it is in this box. When the enemy leaves the box, it stops taking damage. Classic.
What I’m trying to do is just having a beam starting from the damaging actor to follow the damaged actor while its in the box… Pretty simple, I guess but I’m not able to do it properly.

At the moment we are using a little trick as you can see in the last screenshot. We have static mesh, a cube, stretched from the starting point to the end point. It is a placeholder and we’re proabably going to use a particle system afterwards. But I don’t think it’ll make a big difference.

I hope i’m understandable here. If not, do not hesitate to tell me.

Thank you.

Consider a spline + spline mesh component.

What’s wrong with Tick? If you want something updated every frame, you must use it. There literally is no other way around it. If you’re not Ticking something explicitly, something else does it for you.

By doing it yourself you at least control when, how often, and what heavy lifting is included in that Tick. The visual bits need to be update every frame for them to appear fluid in motion.

The trick is to not update stuff that does not need updating too often. As in, must the units’ AI run 60 times per second? Perhaps they will have enough reflexes when they check their surroundings for targets twice per second only.

Also, a particle system may / may not work better here. The source / target of a beam will need to be updated often, ofc.

I would suggest getting into Niagara.
This channel helped me a lot

Also here for the initial beam setup

Then for the follow mechanics you use need to make a user parameter for the beam end variable so you can manipulate it from a blueprint

Video is in french but you can turn the sound of and follow it anyway.

1 Like

Thanks to both of you for your answers. I figured it out.

That is a great channel I didn’t know of… I’m pretty sad Youtuve didn’t want to suggest it to me even with a lot of research on the subject. Now it’s everywhere in my recommandations. Which is good.

I also would recommend this channel also. Helped me out a ton. not specifically Niagara but for blueprint node explanations. I found it buy searching WTF is (name of any blueprint node I didn’t understand)