Nice tutorial. Loved it. I learned a lot of things. At first I thought what am I missing? You can move the cube around. Then I started using Simulate and not run. This worked. Then I saw your other tutorial on how to pick up an object. I'll be watching that next. The reason why it didn't work at 22:00 is because the type of AffectedActors should have been I_Use, because that's the interface you added to the light bulb.
Funny I came here to see how you did your laser system after I implemented mine, and you did it the exact same way, while loop when tracing and also using meshes where most of the people use particles (which looks worse imo). Now I gotta optimize my system :)
while loops are dangerous. sometimes angle of laser causes infinite loop. I suggest using a For Looop With Break instead, where the breaking condition is hitting a non-mirror object. you can tie the Last Index to the length of the number of mirrors in your scene.
am i missing something? where are you pulling the materials like the mirror and light sensor from? is there a separate video somewhere or are we supposed to make them ourselves?
Hey, great tutorial, almost everything is working for me. I have a problem where when I look at the laser beam at most angles, it has a weird "flashing" thing to it. It looks like 100s of smaller rays are being drawn on the outside of the main line. I do have the code implemented to destroy and clear the array at the start of the function, just have no idea why this is happening. It also only happens from most angles. If I walk up to the laser, its fine. It only happens when the laser beam blueprint is spawned from the emitter BP. I placed it into the level with the same scale and length, and didnt have any problems. Please help!
copied from somewhere else in this comment section of someone who solved this, tried it now and it worked! : "Hi, I think this bug occurs because you're spawning your actor with a scale (1.0, 1.0, 1.0) and straight after you're scaling it to (0.05, 0.05, whatever the length).. I managed to remove the weird visual thing by hiding the actor after spawning it and unhide it after the set Ends function!! :) Hope this helps" so basically in the laserOmmiter BP change to this : Spawn actor laser beam -> set actor hidden in game (true) - > set ends - > set actor hidden in game(false) -> add to 'Beams' array
@@aviv1982 As soon as I get back to my PC to test this, ill reply, but this seems like ue4 normal weirdness. Thank you so much for finding this and coming back to this comment!
@@ethandoesguitar1019 sure! Hopefully it works for you as well- just random question- do you have the bug where after an hour or so in the engine the sub-menus start to disappear? Like when in a BP and trying to find a node and the menu disappears for example. Annoys the hell out of me, and I'm on the latest version
@@aviv1982 I thought that bug was just me! It seems to happen when the system has been under a decent load and got to a certain temperature, its super weird, and yep, never happened on older versions, hopefully ue5 will fix all of this
@@Lusiogenic Reducing the tick interval is always good, also shifting the tick on different actors/Instances can help performance significantly. Imagine you have a 100 actor that tick at the same time, that could be a bottle neck, instead you create a variable(float TickInterval ) that you change for every instance, that way they tick at 0.01,0.02 so it is spread out
@@elfideorubio1308 I agree, shifting ticks is a good idea to smooth out framerate, but reducing the tick interval will consume more resources, usually we would want to do the opposite, when possible.
If you have the infinite loop error, just add the reflection counter. Create two float variables, name them for example "Max Number Of Reflections" and "Current Reflection Number". The first thing you do in "Cast Light" function would be setting "Current Reflection Number" to zero. Then in the While Loop condition, you will add boolean AND and connect to it "Current Reflection Number"
@@lv99redchocobo Instead of the while loop: For loop with break, setting max index to "max number of bounces" and breaking on failed hit worked for me.
Nice channel. Thanks. My sensor cube collision doesn't ignore the laser even when I checked the light to be ignored. I duplicated the emitter where it works, but straight away the duplicated sensor glass cube won't ignore the laser. The laser light ignore seems to work only once.
Would there be a way to make a complex material that refracts the laser beam or changes its color? I need this system for a VR game I am making. Thanks in advance!
Yes. Changing the color is fairly easy, when re-emitting the ray, just put another color. The refraction should also be possible, but you just have to take into account the fact that the refracted beam is emitted on the interior of the mesh, so double collision might happen. Just emit two beams in the refraction point and calculate each one of them separately. I might make a tutorial on this in the future, but couldn't tell you when.
1st, amazing tutorials sir. 2ndly, I am searching and searching for some solutions to simulate Radar waves in UE and can't find any....would u be kind make a tutorial about it? I am thinking maybe exchange the arrow shape to a cone shape for example?!!
una duda como se borra la línea de trazado si se quiere un arma para disparar, o es reducir la distancia que tiene a doubt how to erase the trace line if you want a weapon to shoot, or is it to reduce the distance you have
Hey, unsure if you are still replying to these but I'm having a few issues in getting the light to activate when hitting the Sensor. I know its been a while since you recorded but for some reason, it wont light up. Was there anything specific I was supposed to do on the lightbulb end that I didnt? I saw there was some extra nodes you didnt show midway.
You have to Create it Right click then go to Blueprint then Create Blueprint Interface and simply Copy his add Bool name it what you wont his is 0n/off
If you still respond to comments, can you PLEASE help? For some reason the laser beam spawns in the middle of the box it’s shooting off of and the middle of what it’s reflecting off of. This leaves it shooting out of the other side of the box although that side doesn’t do anything. The end of the beam doesn’t enough touch the surface. Got any ideas on what I’m doing wrong?
For anyone who is having this issue, I had this problem too, the fix was going into the laser beam bp, and making sure at the very beginning, from the set end function, make sure you are plugging the begin point into the BOTTOM part of the subtraction node, and the End Point into the TOP of the subtraction node. i.e. you are subtracting the begin point FROM the end point. At least that was the fix for me :)
If anyone runs into this issue you can find the fix I did here: i.imgur.com/rtYoA83.png Basically you can move the start point along the forward vector by half the vector length and that should offset having the location in the middle of the mirror.
I can´t help myself but am I only one who has problem with framerate adn then also preformance as it is overfilling memory? Running Unreal 4.27.1, is there way to fix this issue? Thankl you.
Hi, I have watched the entire video and then decided to do it by myself. I got to about 8 minutes mark when I have noticed that from some reason my beam goes up in 45 degrees instead of following the arrow. I have tried different things, watched and done step by step with the video, and it is still doing the same thing. It is like the beam doesn't want to follow the arrow direction at all. Any ideas?
Are the line traces for the beam working correctly? Make sure that you test that using the debug drawing of the line trace. If the line trace is not correct, then you have to make sure that you calculate it correctly. Check the location and rotation of the arrow. Make sure that you use GetWorldLocation, not local. Check also the GetForwardVector for the arrow. If the line trace is correct, then the visual representation is the problem. Check the rotation and position of the beam mesh (in my case, it was the cylinder). Also, check the origin point of the beam mesh.
Not working at all. If line hits mirror then loop goes to infinite and if it hits something otherthan mirror or nothing then works fine. It doesn't reflect in either case. I followed the same thing.
I have checked the setup in the latest version of the engine (4.24), it works as expected. Make sure to check the loop condition after the first line trace.
If you have the infinite loop error, just add the reflection counter. Create two float variables, name them for example "Max Number Of Reflections" and "Current Reflection Number". The first thing you do in "Cast Light" function would be setting "Current Reflection Number" to zero. Then in the While Loop condition, you will add boolean AND and connect to it "Current Reflection Number"
If you look in the Light Bulb Blueprint (video description), you'll see that there's a LightIntensity. You can manipulate that. If you want the trigger to send an intensity to the light bulb, pass the intensity through the interface, instead of On/Off information.
@@Lusiogenic Thanks for the heads up, I did that but it didn't work. Do you think it's because I put a material instance on the light bulb, because that's where the intensity is coming from?
Thks ! This tutorial works fine 4.19... I have one problem ==> When I run this in thirdperson game mode, the scale of laserbeam is not stable at x and y axis when the player looks around that but the length of z has no problem. Any suggestions for this kind of problem? Thks again :}
You may be scaling it in world coordinates, which is not what you want. You should be scaling in local coordinates of the beam actor. Are you parenting the beam to a component of the third person character? If so check that the component that you're parenting to have the correct scale. Also, make sure that you have the correct rotation of the cylinder in the beam actor, otherwise it will scale on the wrong axis. Last thing, make sure that the cylinder has the origin on the base, and not in the middle. If the origin is in the middle, it will scale in both direction and you will have to recalculate its position to be in the middle.
I have this problem as well. Followed your example. It seems to pulse weirdly with every time the even fires (when your delay in the emitter sends the cast beam function. I tried just scaling the laser beam blueprint in editor and i don't get this issue but when the laser is created at runtime on the emitter it has this graphical glistch Hidden Konitsu mentioned. I'm on 4.20.1
Have you tried what I've mentioned in my last comment? I would be helpful if you made a short video with the problem, it's really hard to make out from your description what the problem is. Make sure that you make the trace visible and see if it's valid or if it hits something else before your target object. It might be colliding with the player character, you have to make sure that the player character ignores the Light trace channel.
Hi, I think this bug occurs because you're spawning your actor with a scale (1.0, 1.0, 1.0) and straight after you're scaling it to (0.05, 0.05, whatever the length).. I managed to remove the weird visual thing by hiding the actor after spawning it and unhide it after the set Ends function!! :) Hope this helps!
@@Lusiogenic I believe she's talking about when you copy the classic light bulb and mention how it has a simple interface but didn't fully explain that process.
This IS programming, just the visual kind. A lot more easy to understand for beginners then C++. Frankly, I can code in C++, but I don't want to be bothered with the complexity that it adds when I'm prototyping. Most of the people spend time prototyping, so Blueprint makes more sense. I expect that when people go into the later stages of development, it's their duty to optimize the code and pass it in C++ if necessary.
Download file for the Light Bulb asset can be found in the description.
Nice tutorial. Loved it. I learned a lot of things.
At first I thought what am I missing? You can move the cube around. Then I started using Simulate and not run. This worked.
Then I saw your other tutorial on how to pick up an object. I'll be watching that next.
The reason why it didn't work at 22:00 is because the type of AffectedActors should have been I_Use, because that's the interface you added to the light bulb.
Awesome work man!
I only watched few videos but this is some quality content! Keep it up!
Funny I came here to see how you did your laser system after I implemented mine, and you did it the exact same way, while loop when tracing and also using meshes where most of the people use particles (which looks worse imo). Now I gotta optimize my system :)
while loops are dangerous. sometimes angle of laser causes infinite loop. I suggest using a For Looop With Break instead, where the breaking condition is hitting a non-mirror object. you can tie the Last Index to the length of the number of mirrors in your scene.
am i missing something? where are you pulling the materials like the mirror and light sensor from? is there a separate video somewhere or are we supposed to make them ourselves?
Your tutorials are amazing!, And most fun.
Hey, great tutorial, almost everything is working for me. I have a problem where when I look at the laser beam at most angles, it has a weird "flashing" thing to it. It looks like 100s of smaller rays are being drawn on the outside of the main line. I do have the code implemented to destroy and clear the array at the start of the function, just have no idea why this is happening. It also only happens from most angles. If I walk up to the laser, its fine. It only happens when the laser beam blueprint is spawned from the emitter BP. I placed it into the level with the same scale and length, and didnt have any problems. Please help!
same problem, would love the help if anyone encountered this
copied from somewhere else in this comment section of someone who solved this, tried it now and it worked! :
"Hi, I think this bug occurs because you're spawning your actor with a scale (1.0, 1.0, 1.0) and straight after you're scaling it to (0.05, 0.05, whatever the length)..
I managed to remove the weird visual thing by hiding the actor after spawning it and unhide it after the set Ends function!! :) Hope this helps"
so basically in the laserOmmiter BP change to this : Spawn actor laser beam -> set actor hidden in game (true) - > set ends - > set actor hidden in game(false) -> add to 'Beams' array
@@aviv1982 As soon as I get back to my PC to test this, ill reply, but this seems like ue4 normal weirdness. Thank you so much for finding this and coming back to this comment!
@@ethandoesguitar1019 sure! Hopefully it works for you as well- just random question- do you have the bug where after an hour or so in the engine the sub-menus start to disappear? Like when in a BP and trying to find a node and the menu disappears for example. Annoys the hell out of me, and I'm on the latest version
@@aviv1982 I thought that bug was just me! It seems to happen when the system has been under a decent load and got to a certain temperature, its super weird, and yep, never happened on older versions, hopefully ue5 will fix all of this
3:20 don't use delay instead go to class defaults and set the tick interval to be 0.01
Thanks, didn't know about that.
Are there any advantages for using that method?
@@Lusiogenic Reducing the tick interval is always good, also shifting the tick on different actors/Instances can help performance significantly. Imagine you have a 100 actor that tick at the same time, that could be a bottle neck, instead you create a variable(float TickInterval ) that you change for every instance, that way they tick at 0.01,0.02 so it is spread out
@@elfideorubio1308 I agree, shifting ticks is a good idea to smooth out framerate, but reducing the tick interval will consume more resources, usually we would want to do the opposite, when possible.
@@Lusiogenic My bad I meant Increasing rather than reducing.
If you have the infinite loop error, just add the reflection counter. Create two float variables, name them for example "Max Number Of Reflections" and "Current Reflection Number". The first thing you do in "Cast Light" function would be setting "Current Reflection Number" to zero. Then in the While Loop condition, you will add boolean AND and connect to it "Current Reflection Number"
Maybe I'm not doing it right, but this isn't working for me. :( The condition seems to always be coming back false so the while loop doesn't even run.
@@lv99redchocobo Instead of the while loop: For loop with break, setting max index to "max number of bounces" and breaking on failed hit worked for me.
How to remove the green and red lines?
In the LineTraceByChannel, change Draw Debug Type to 'None'
Классные уроки) Спасибо 👍
Nice channel. Thanks. My sensor cube collision doesn't ignore the laser even when I checked the light to be ignored. I duplicated the emitter where it works, but straight away the duplicated sensor glass cube won't ignore the laser. The laser light ignore seems to work only once.
Would there be a way to make a complex material that refracts the laser beam or changes its color? I need this system for a VR game I am making. Thanks in advance!
Yes. Changing the color is fairly easy, when re-emitting the ray, just put another color.
The refraction should also be possible, but you just have to take into account the fact that the refracted beam is emitted on the interior of the mesh, so double collision might happen. Just emit two beams in the refraction point and calculate each one of them separately.
I might make a tutorial on this in the future, but couldn't tell you when.
@@Lusiogenic OK thank you!
Very cool and easy to follow!
Can you teach how to open a door too bcs i did it but the door is looping and flickering 365 degrees
thank you for sharing this lovely tutorial
Great video, man 💯
I try create Object to reflection the Light. But, the light always "False" when the Light hit the Object?
1st, amazing tutorials sir.
2ndly, I am searching and searching for some solutions to simulate Radar waves in UE and can't find any....would u be kind make a tutorial about it?
I am thinking maybe exchange the arrow shape to a cone shape for example?!!
This is great! Thanks so much!
I'm at 13:22 rn and my project is rendering the lazer but just after that it stops rendering it send help.
una duda como se borra la línea de trazado si se quiere un arma para disparar, o es reducir la distancia que tiene
a doubt how to erase the trace line if you want a weapon to shoot, or is it to reduce the distance you have
It is so amazing! Thanks a lot
How do you make it so that the line trace goes through the glass? I didn't see a blueprint for that part.
i think that is the visibility set to "light"
Hey, unsure if you are still replying to these but I'm having a few issues in getting the light to activate when hitting the Sensor. I know its been a while since you recorded but for some reason, it wont light up. Was there anything specific I was supposed to do on the lightbulb end that I didnt? I saw there was some extra nodes you didnt show midway.
Hi guys !
I can't find anymore the "BPI_set_state"... 17:32
Need help
You have to Create it Right click then go to Blueprint then Create Blueprint Interface and simply Copy his add Bool name it what you wont his is 0n/off
If you still respond to comments, can you PLEASE help? For some reason the laser beam spawns in the middle of the box it’s shooting off of and the middle of what it’s reflecting off of. This leaves it shooting out of the other side of the box although that side doesn’t do anything. The end of the beam doesn’t enough touch the surface. Got any ideas on what I’m doing wrong?
It's hard to give advice without knowing the BP, but pay attention to the spawn coordinates and what their relative parent is.
For anyone who is having this issue,
I had this problem too, the fix was going into the laser beam bp, and making sure at the very beginning, from the set end function, make sure you are plugging the begin point into the BOTTOM part of the subtraction node, and the End Point into the TOP of the subtraction node.
i.e. you are subtracting the begin point FROM the end point.
At least that was the fix for me :)
If anyone runs into this issue you can find the fix I did here: i.imgur.com/rtYoA83.png
Basically you can move the start point along the forward vector by half the vector length and that should offset having the location in the middle of the mirror.
@@BassNuke thank you very much, I have been blocking on it for 1 week! Thanks
@@BassNuke hey bro ! Thank you so much !!!!!!! I did the same thing, but it didn't work properly, so I thought it was crazy
thx for the lazer system :)
how do i make it so when i hit a specific material the laser changes color
Check these answers out:
forums.unrealengine.com/t/how-to-get-material-by-line-trace/374943
I can´t help myself but am I only one who has problem with framerate adn then also preformance as it is overfilling memory? Running Unreal 4.27.1, is there way to fix this issue? Thankl you.
Hi, I have watched the entire video and then decided to do it by myself. I got to about 8 minutes mark when I have noticed that from some reason my beam goes up in 45 degrees instead of following the arrow. I have tried different things, watched and done step by step with the video, and it is still doing the same thing. It is like the beam doesn't want to follow the arrow direction at all. Any ideas?
Are the line traces for the beam working correctly? Make sure that you test that using the debug drawing of the line trace.
If the line trace is not correct, then you have to make sure that you calculate it correctly. Check the location and rotation of the arrow. Make sure that you use GetWorldLocation, not local. Check also the GetForwardVector for the arrow.
If the line trace is correct, then the visual representation is the problem. Check the rotation and position of the beam mesh (in my case, it was the cylinder). Also, check the origin point of the beam mesh.
Not working at all. If line hits mirror then loop goes to infinite and if it hits something otherthan mirror or nothing then works fine. It doesn't reflect in either case. I followed the same thing.
I have checked the setup in the latest version of the engine (4.24), it works as expected.
Make sure to check the loop condition after the first line trace.
Same issue
If you have the infinite loop error, just add the reflection counter. Create two float variables, name them for example "Max Number Of Reflections" and "Current Reflection Number". The first thing you do in "Cast Light" function would be setting "Current Reflection Number" to zero. Then in the While Loop condition, you will add boolean AND and connect to it "Current Reflection Number"
I can't find "BPI Set State" it doesn't exist in my file
Please help
you have to create the interface
@@liliansitha1 I figured it out weeks ago, thanks for the reply tho !
Could you explain how you did it ?
@@Jfidjsidbfusbzid Right click in your folder in the main window and in "blueprint" there should be a thing named "interface"
How do you get the light intensity to work with the simple light bulb?
If you look in the Light Bulb Blueprint (video description), you'll see that there's a LightIntensity. You can manipulate that.
If you want the trigger to send an intensity to the light bulb, pass the intensity through the interface, instead of On/Off information.
@@Lusiogenic Thanks for the heads up, I did that but it didn't work. Do you think it's because I put a material instance on the light bulb, because that's where the intensity is coming from?
@@Lusiogenic Actually I just answer my own question lol. Thanks for the tutorial by the way. It was very helpful, and just what I was looking for.
@@Lusiogenic I dont See Light Bulb Blueprint in video description
Thks !
This tutorial works fine 4.19...
I have one problem ==> When I run this in thirdperson game mode, the scale of laserbeam is not stable at x and y axis when the player looks around that but the length of z has no problem.
Any suggestions for this kind of problem?
Thks again :}
You may be scaling it in world coordinates, which is not what you want. You should be scaling in local coordinates of the beam actor.
Are you parenting the beam to a component of the third person character? If so check that the component that you're parenting to have the correct scale.
Also, make sure that you have the correct rotation of the cylinder in the beam actor, otherwise it will scale on the wrong axis.
Last thing, make sure that the cylinder has the origin on the base, and not in the middle. If the origin is in the middle, it will scale in both direction and you will have to recalculate its position to be in the middle.
I have this problem as well. Followed your example. It seems to pulse weirdly with every time the even fires (when your delay in the emitter sends the cast beam function. I tried just scaling the laser beam blueprint in editor and i don't get this issue but when the laser is created at runtime on the emitter it has this graphical glistch Hidden Konitsu mentioned. I'm on 4.20.1
Have you tried what I've mentioned in my last comment? I would be helpful if you made a short video with the problem, it's really hard to make out from your description what the problem is.
Make sure that you make the trace visible and see if it's valid or if it hits something else before your target object. It might be colliding with the player character, you have to make sure that the player character ignores the Light trace channel.
Hi, I think this bug occurs because you're spawning your actor with a scale (1.0, 1.0, 1.0) and straight after you're scaling it to (0.05, 0.05, whatever the length)..
I managed to remove the weird visual thing by hiding the actor after spawning it and unhide it after the set Ends function!! :) Hope this helps!
@@MrThroughHeart It helped me 4.21.1
really nice, man)
Trying to replicate this, and I can't find the light bulb blueprint anywhere, I've tried my best to make it work and I can't. Please help
Please check description I've put the Light Bulb asset there.
Just copy the contents of the Content folder into your project's Content folder.
@@Lusiogenic Thank you so much man, this helps so much!
Amazing tutorial and still relavent to 5.4
5.4 is the only version with chaos which seems to be stable enough to be usable.
A delay on an event tick while it might work, is not the best way to do it, use an event timer with loop
my laser isnt showing up at all
Infinite loop detected. Blueprint: BP_LaserEmitter Function: Branch Call Stack: Show. Why? :(
you made a loop function. i dont know exactly what but just check if you see anything wrong there.
Cool !)
like why didn't you include telling us about the light BP
What light BP, can you be more specific? I will try to make it available if it isn't already.
@@Lusiogenic I believe she's talking about when you copy the classic light bulb and mention how it has a simple interface but didn't fully explain that process.
But now I understand what you did.
You are right, I forgot to include the Light bulb blueprint and material. You can now find them both in the video description.
@@Lusiogenic thank you!
it doesn't work with the newest versions
im having an issue with infinite loops, its so annoying
4.21 has broken this code. Infinite loop created with exact code. Edit: While loops in 4.21 are broken and will only result in errors.
Do you find a answer/solution to this thing?
@@firimousse3676 Nope, I fount a post from 2014 about the same issue, so it seams a previous fix has been broken again.
@@quantonium8298 fuck :/
I've checked in 4.22, seems to be working fine. Can you check again?
Same problem here (4.23.1), I've tried to increase the maximum loop iteration count but still not working :(
And this should be easier and more understandable than programming? Bet you could do this in 100 Lines of code.
This IS programming, just the visual kind. A lot more easy to understand for beginners then C++.
Frankly, I can code in C++, but I don't want to be bothered with the complexity that it adds when I'm prototyping.
Most of the people spend time prototyping, so Blueprint makes more sense.
I expect that when people go into the later stages of development, it's their duty to optimize the code and pass it in C++ if necessary.
@@Lusiogenic coming from a coding background, I find the visual style more complex. But i agree it's just my personal opinion.
Why does my light diverge?
Hey man , my light as well , have you found a solution ?
wires are horrible, how you even read this?
Portal 2 :p
:) I do plan on making a part two for this tutorial. One feature that I'm thinking of is beam splitter.
Sweet sweet sexy laser beams... :)
Too much. More simple