Announcement

Collapse
No announcement yet.

Get overlapping actors returns random(ish) results?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Click image for larger version  Name:	000.png Views:	2 Size:	489.5 KB ID:	1548790
    Above are 5 grass actors in edit view. Below is while holding the actor with collision disabled.

    Click image for larger version  Name:	002.jpg Views:	1 Size:	85.0 KB ID:	1548791
    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.

    Click image for larger version  Name:	003.jpg Views:	1 Size:	65.1 KB ID:	1548792
    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.

    #2
    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?

    Comment


      #3
      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.

      Comment


        #4
        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.

        Click image for larger version  Name:	001.jpg Views:	4 Size:	123.2 KB ID:	1550320

        Click image for larger version  Name:	002.jpg Views:	1 Size:	138.9 KB ID:	1550321

        Comment

        Working...
        X