InstancedStaticMesh Overlapping Sphere 'misses' instances
I've set up a 2D array of InstancedStaticMesh instances, and I'm using the GetInstancesOverlappingSphere function to try to remove any that show up within a certain radius of a given point - the goal is to create an "explosion" and have the pieces there removed and replaced. The blueprint is simple, as seen below:
However, not all pieces within the radius, when called are removed, see here. I'm calling explosions in the same locations, but not all pieces are recognized. Any ideas whats happening?
asked Jan 30 '16 at 12:00 AM in Blueprint Scripting
The "get instances overlapping sphere" may or may not work, but in your picture, the main problem is that you are, just like I did, removing instances directly from an array which you then continue to work on. What I mean is, as you remove one item, it resizes so now the next item may actually be the wrong item.
I have now learned that if I need to remove more than one item from an array, think about it some.
answered Sep 26 '16 at 10:24 PM
That's interesting @ste1nar ...
But there is also the RemoveInstances node, which will clear them all, just give the reference to the array result of the sphere overlap.
For example with a foreachloop, do anything per instance during the loop body - but not delete, as @ste1nar made clear ... then, from the Complete pin, call RemoveInstances.
Follow this question
Once you sign in you will be able to subscribe for any updates here