How to get around GetOverlappingActors leaving actors in the array

I currently have a blueprint where I drag and drop actors into a trigger volume.

When dropping 2 actors into the trigger volume, it checks to see if they match. If not, they’re sent outside of the trigger volume.

When actors are sent outside, it registers as still having an actor in it. Because of the issue, it attempts to match 1 actor with the ghost actor, instead of waiting for a second one.

Looking around, I found the issue where because of the way “GetOverlappingActors” works, it tends to leave actors in the array. I have the array imported into an array in my control and I’ve attempted resolving the issue by clearing either and both arrays at the end of the code among other things. Nothing I’ve tried works.

Hello Quartaroy,

Get overlapping actors returns an array, I have also found that at times it will inject null entries into the array, so watch out for this as well. I wrote a little function to “clean” the array up, before using it.

The “new” array that is being set should be fine, because of the set, conceptually that set, wiped out the “old” array and put the “new” array just retrieved in it’s place. Myself, I would not use the Get Overlap count, but use the “length” node for the the array that was just set, in order to determine how many actors were returned. The reason is, there is going to be less code to execute, and it has to be more “stable” code as it’s such a trvial function and is being tested all the time, during the unit testing of other “nodes” during the development cycle.

I have never found that the get overlap actors failed to get all the actors, that were overlapping. What I did find was that because of the speed of the machine, when a actor, or primitive component etc, moved outside of the area of the “trigger” that if there was “wobble” (i.e. some form of moving back and forth), that the event would be triggering very rapidly, as it moved into the “trigger” and back out, all the time, looking like that it was not in the trigger area.

One thing you might want to try, is to

  1. clean the array of nulls etc, before usage, I’m referring to the array returned by get overlapping actors.
  2. Immediatly get overlapping actors, and then clean it,and compare the two arrays, to see if they match

This might give you some more information about what is going on.

Hope this helps,

I share the experience. I’ve never had a problem getting all the actors in the the volume, the dilemma comes when moving all the actors out. It always leaves a ghost.

There doesn’t seem to be a way to clear the null array. I’m able to clear the overlappingActors array, but that doesn’t help me solve anything. The error is really complex. even after attempting to manually track entering and exiting actors, it will hiccup and miscount after a few movements.

Quarteroy,

If you would, go into the blueprint functions that you believe are affecting this, and do a Ctrl+A, and then Ctrl+C, that will copy all the information about the nodes onto the clipboard, at which point you can paste them into your favorite text editor, and save the file, then just upload that, which allows me to re-create all the functions you have copied, by merely copying and pasting again into the UE4 editor, it’s much more efficient for both of us, than me looking at images.

When you copy into your text editor, you get a VERY good glimpse into the internal workings of the unreal blueprint editor.

So if you would upload those text files, I would be more than happy to take a look at it with you, as I have a real interest in this.

Thank you!

as a side note, all my work has been done using Box Collision, not a trigger, but as i’m about to release a product for the marketplace, I’m very curious to see if trigger volumes do something different.

Solved the issue by moving all the code from the level blueprint to a blueprint created from the trigger volume and adding a .05 second delay right before the setActorLocation events. I also converted the forEachLoop to a sequence, and draw out each actor that way with a get node.

With these changes, it seems to work flawlessly. I believe there may have been some interaction faults between my drag-and-drop blueprint with this particular blueprint, in perhaps that all the events were firing simultaneously and running into problems.