Trace ignores HISM Components?

Can you confirm that the array spat out by the Multi Sphere Trace node contains multiple elements? Or is it completely empty?

I have a bp that can spawn many actors in, it for loops through all hism components and if there are more then 10 it will get a random one and delete everything around it, but my trace absolutely refuses to acknowledge the existence of theses actors. Everything collision is good and the trace responses are all correct. Any help appreciated.

A string confirms it is picking them up. For some reason they aren’t getting removed though.

A string confirms it is picking them
up.

So the trace is not ignoring them like the title suggests, right? It does pick them up but they’re not being removed? Can you confirm that?

How many instances are there in the component? Are we talking 100 or 100000?

Providing the Multi Sphere Trace array does, indeed, contain what you think it does, I’d attribute this issue to something else. I believe that the instances are being removed but without you noticing. You can count them before and after the operation.


Essentially, whenever you remove an instance, all indexes are shuffled. The next index in that loop is not assigned to the instance you expect.

This is easy to fix: instead of removing the instances one by one, add the indexes to an additional int array. When that loop Completes, remove them like so:

Ignore the sets. Then 0 identifies what needs to be removed, Then 1 removes all instances in one go so the indexes are not shuffled.

Unfortunately that’s not the case here. You’re simply reverse iterating through the array, removing an instance will still rejiggle indexes - have a look:

Image from Gyazo

better quality: https://i.gyazo.com/6be8a8e6a575f3ce2195415beb77c0ba.mp4

I’m removing 1 per second. Notice how some indexes jump around. Even if you remove just 1, things shift around.

I was under the impression my reverse for loop would iterate through reverse so the ints being shuffled wouldn’t effect it?

The trace hits the first one and then seems to stop, but it won’t seem to remove all that are hit, just some.

In the animation above, on the very right hand side, you can see 92 and 93 turning into 5 & 11. When I remove the 8th & 9th element, there can be no index 92 or 93 anymore. So these 2 get reassigned whatever lower index is available due to removal of other instances.


If I start removing indexes, it all shrinks:

You need to remove the entire hit array at once as shown above - take a closer look. Removing them one by one will not work - explained why below.

In your example, you’re still doing the same thing.

I don’t think that’s gonna work that way, their are multiple different actors that need to be removed. I’m trying to do it by tag since it will work across multiple different hism components but adding them to a set and then doing remove instances still does nothing.

Maybe because the array is just ints? Shouldn’t I be storing the instances that are hit, not ints?

I’ve never used sets before… I can’t figure out how I actually add the ones that need removed to the set. Integer isn’t compatible with set of integers and I have no idea how to add the ones that are getting hit to this set.

Maybe because the array is just ints?
Shouldn’t I be storing the instances
that are hit, not ints?

You should be storing instances’ indexes - they’re ints. Essentially, if you want to remove a bunch of instances from a HISM by index, you need to remove all indexes in one go, via the Remove Indexes (plural) node. Never in a loop.


You do not need sets - not for what is demonstrated above at least. I use them as the procedural generation in my project is somewhat involved and I need to efficiently operate on a large numbers of elements without worrying about iterating over the same indexes again.

I’ve never used sets before

You probably have, you mastered them somewhere in primary school. It’s usually about fruit, shapes, animals and whatnot:

Since HISMs’ instances always have unique numbers, sets make perfect sense here. If you want to, lets say, drop 3 bombs on the cubes below and remove everything the explosion radius hits, you’d combine 3 sets. Unlike an array, a set of 3 overlapping results would produce the precise number of uniquely indexed elements which you can later on remove with Remove Indexes - all in a single BP execution, and without giving the indexes a chance to reshuffle.

This is the setup I’m attempting to use, it should loop through every component, but same problem, either nothing is getting removed or it’s maybe 1 instance in every loop.

Since HISMs’ instances always have unique numbers

Is that gonna work across multiple hism components though? Say I have 3 or so and They can spawn in clusters and I want to remove any hism instances that are hit by a sphere trace. They all share the same tag so I figured a multi sphere with a tag loop would be enough.

No, you’d need to perform one removal for each component.

But this would just give you a single index. The trace does not really work if you want to hit more than one. You’d need need use this:

When you hit the first instance, place the above at the instance’s location and it gives you everything around it.

edit: I’ll try to come up with a better example if I find some time.

Do note that sphere trace will stop if it encounters a blocking hit. So the above should be done on a separate, dedicated collision channel ideally.

This is the setup I’m attempting to
use, it should loop through every
component, but same problem, either
nothing is getting removed or it’s
maybe 1 instance in every loop.

Explained above (and several other places in the thread) why this wouldn’t work. Attached a working example in the answer.

Sorry, can’t do more for you.

I wrote that out long before you posted your final few comments, I’m busy now but I can try the new setups tomorrow morning and I’ll update this post tor reflect it.

Apologies, working on many things at a time. I often fail to keep track of them all well enough.

No dice…