# Laser beam that locks and follows a target

**URL:** <https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4-26\
**Created:** [May 4, 2021, 1:07pm UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735 "2021-05-04T13:07:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ednoc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ednoc](https://forums.unrealengine.com/u/Ednoc)\
**Post date:** [May 4, 2021, 1:07pm UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735/1 "2021-05-04T13:07:49Z")

</div>

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 !

 ![Screen1](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/6/e641f56755195167c36c608abed6a78e24d76241.jpeg)  
(You can find some videos of how it behaves easily. Or you can clic [here](https://youtu.be/7OKDihChVnk?t=210).)

I followed these tutorials: [https://www.youtube.com/watch?v=iM29ssveRsE](https://www.youtube.com/watch?v=iM29ssveRsE)  
(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.

 ![Screen2](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/5/95cc828c116690b7a698047084f59f4e123802c0.png)  
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.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 4, 2021, 1:41pm UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735/2 "2021-05-04T13:41:56Z")

</div>

Consider a spline + spline mesh component.

> [@Connect mesh between two world vectors at runtime?](https://forums.unrealengine.com/t/connect-mesh-between-two-world-vectors-at-runtime/213028/13):
>
> Lol tell me about it!

> [@Ednoc](#):
>
> 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.

* * *

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.

---

<div class="post-metadata">

**Author:** ![Seed\_37](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seed_37/32/88718_2.png) [@Seed\_37](https://forums.unrealengine.com/u/Seed_37)\
**Post date:** [May 4, 2021, 1:43pm UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735/3 "2021-05-04T13:43:12Z")

</div>

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

> **[gameDev Outpost](https://www.youtube.com/channel/UC3Yf1SuYLc5WdChEgXRA6OQ)**
>
> Share your videos with friends, family, and the world

Also here for the initial beam setup

> [@Niagara: Looping beam with infinite lifetime](https://forums.unrealengine.com/t/niagara-looping-beam-with-infinite-lifetime/145291/6):
>
> There is an option under the emitter state called loop behavior, you can set it to infinite, loop or once. The problem is on infinite between the end of the loop and beginning of the next loop it stops emitting particles for a frame and resultants in a flicker. I am not sure if it has something to do with the initial beam set up or it’s just a glitch. I have also tried setting the “Lifetime” in the particle spawn module to a higher and lower number then the “loop duration” and it either causes…

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.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/6/e/26e9231cc056a0a7f29d8dd26e820937108fbff0.jpeg "Niagara : How to create electric arcs between 2 points - UE4 tutorials") ](https://www.youtube.com/watch?v=SajyFZ35OBI)

---

<div class="post-metadata">

**Author:** ![Ednoc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ednoc](https://forums.unrealengine.com/u/Ednoc)\
**Post date:** [May 7, 2021, 7:54am UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735/4 "2021-05-07T07:54:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Seed\_37](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seed_37/32/88718_2.png) [@Seed\_37](https://forums.unrealengine.com/u/Seed_37)\
**Post date:** [May 8, 2021, 10:30pm UTC](https://forums.unrealengine.com/t/laser-beam-that-locks-and-follows-a-target/227735/5 "2021-05-08T22:30:36Z")

</div>

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)

> **[Mathew Wadstein](https://www.youtube.com/channel/UCOVfF7PfLbRdVEm0hONTrNQ)**
>
> This channel is dedicated to exploring Unreal Engine 4 and the Blueprint programming language that it uses. You can think of it as a companion to the API documentation as I try to cover the how and why for what things are used for when using the...
