Get overlapping actors returns random(ish) results?

In my game you can grab an object and drop it in another spot. While holding the actor, object collision and physics are disabled. Upon releasing the object I enable collision and try to get overlapping instances of this grass mesh, then destroy overlapping grass actors.


Above are 5 grass actors in edit view. Below is while holding the actor with collision disabled.


Once I release the object I enable collision, get overlapping actors array and destroy overlapping grass actors via for each loop. However, it always only destroys 3 of the 5 actors.


If I grab the board again and release it in the exact same spot, then one more of the actors will be detected and destroyed, and finally if i grab it again and release it one last time, the final grass actor will be destroyed. Does anyone know why get overlapping actors is only returning SOME of the overlapping actors each time it is called? Any help would be greatly appreciated.

So I’ve tried everything I can think of including creating a new basic cube actor to test with instead of the grass mesh. Ive discovered that the get overlapping actors output array is only populated with exactly half or the greater half of the overlapping actors. If 8 overlapping than 4 are returned, if 7 then 4 are returned, If 6 then 3, and so on.

I’m fairly certain that this has got to be a bug in 4.20.3. Can anyone else reproduce it?

Could you post screenshot of your blueprint logic?
The first idea that comes to mind is that while you are looping through the array to destroy the actors, you are also removing the elements from array which makes other array elements shift one place each loop while index increases causing the for loop to skip elements.

Thank you for your reply. I’ve discovered that this is absolutely a bug. The for each loop doesn’t properly iterate through the output of get overlapping actors. However, If you add the additional step of promoting the output array to a variable and then call that variable for the for each loop, it functions as you would expect.

I whould try to insert a Validity Test before destroy Actor. This gets me all the time.

I asked about this the other day on AH. GetOverlappingActors doens’t work correctly in 4.24 apparently.

I’ve also noticed this, GetOverlappingActors worked fine in 4.22, but the exact same blueprint fails in 4.24.

I ran into this myself recently, I think. I had a similar issue with line traces. If line traces and overlap shapes (and sweeps) are inconsistent right now, how should we approach consistent melee hit detection?

To add to this now, I read the other day, it’s intentional. There’s an option in the details of overlap boxes ( not sure about line traces ), called something like ‘calculate initial position’, or something like that. Take that with a very large pinch of salt, I can’t recall the exact parameter name, but it’s used to specify calculation of begin player overlap.