I have in my game some dynamite and a dynamite box. I would like to send a line trace from the dynamite box to the dynamite to check if it is in range.
I have been using sphere overlaps to detect overlapping, but this also causes it to work through walls, which I don’t want to happen.
I have two options but I don’t know how to implement them properly.
1.) Somehow limit the length of the line trace. It would still need to be heading towards the actors in question.
2.) Line trace, then add hit actors to an array, then check to see if hey are also overlapping. Then make those hit + overlapping actors perform the function.
I have managed to send out multiple line traces with a for each loop and confirmed they are hitting things.
I suppose what I’m asking is, if there is a way, to add all the dynamite that was hit by the line trace, into an array and then I can check if they are overlapping.
If I wanted to throw a stick of dynamite and have it hit stuff that’s not behind cover, I’d use that However, there’s also this bit:
if there is a way, to add all the dynamite that was hit by the line trace, into an array and then I can check if they are overlapping.
Perhaps you could elaborate what we’re really doing? Ignore the technicalities, what’s the gameplay scenario like? What’s really happening to all that ?
Yeah, that should be pretty trivial to setup. The damage interface is already there, take advantage of it. You, kind of, don’t really need to script much to make it work. More on collision: