I have a simple 2D game and I’ve created a particle system under the form of a beam. Now that beam is basically a laser. The emitter source is a simple cube for now and so is the target. I have set a ‘delay’ before the ‘enable emitter’ node so that the laser beam appears when I need it to.
My problem is that I cannot for the life of me figure out how to make the actual beam ‘particle’ detect a collision with any of my characters. The emitter itself or the target (both cubes) do detect the collision, but the particle effect, the laser beam itself does not detect any. I have fiddled with the collision presets - tried dynamic, pawn, vehicle etc. but none worked. Is it necessary that the beam itself should be a mesh first of all? that would undoubtedly detect a collision just as any other object.
Thank you!
You have to do that on tick. Set a Line Trace from the first cube towards the second, and check if it hits something. Or Multitrace, depending on how you want it to act.
Ok so I have followed you and the line trace does work. I do have a problem though -
So the line trace detects both characters, but I want the one character that crosses the line to be slowed. Now, how do cast to both of them if that makes sense, or how do I make it so that the one crossing the line is affected, no matter which one out of the 2 characters. If I cast to one of them, only that one will be affected. But I don’t know how to cast to both of them in this situation. Check the screenshot. I basically need a target for both ‘character movement’ and ‘hit actor’.
I did as you said but now something weird is happening. The multi + for is ok (added custom event because ForEach hates delays), but there’s something wrong with the character index.
In this situation P1 gets affected, but P2 doesn’t? If I plug the Player Index to ForEach’s Array Index, then when P1 crosses the line both characters are affected and vice-versa, with P2 not going back to normal speeds ever. It’s so confusing, that is.
You have to use the Break Hit Result to get actors (Hit Actor pin), and not Get Player Character, because like this you set parameters to only one of them.
So then how can I possibly make the transition from the ‘Hit Actor’ pin to the ‘Character Movement’ pin, because ‘C Movement’ pin is asking me for a target - which would be the ‘Hit Actor’.
I have got 2 different characters. I would have to use two casts - cast on char 1 then cast on char 2, which won’t work. I can either cast it to Player 1 or Player 2.
I have no experience using Blueprint Interfaces. Like, at all.
Thank you and sorry for the late answer, been caught at work for the past days.
Any way to disable the line trace and activate it whenever I decide to? Or make it ineffective or something of sorts?
If you use it with a timer, you can Pause/Unpause Timer by Handle; if you use tick, you can either disable/enable tick; if tick is used for something else, just place a branch with a bool just before the Line Trase.