x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

InstancedStaticMesh Overlapping Sphere 'misses' instances

Hey,

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:

alt text

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?

Product Version: UE 4.10
Tags:
_ue401.png (108.4 kB)
more ▼

asked Jan 30 '16 at 12:00 AM in Blueprint Scripting

avatar image

Kowbell
150 17 26 38

avatar image Slavq Aug 05 '16 at 08:42 PM

I'd encourage you to move this to Bug Reports (you can do this via 'Move to Space' option) and provide some reproduction steps. Or maybe you've already solved it? I have a similar problem, Get Instances Overlapping Sphere doesn't get all the instances, even if they're totally inside the sphere. I'm on 4.12.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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.

  • Make an int array and save the "get instances overlapping sphere" result.

  • Use the Max Of Int Array node on the int array; we need to work from the highest instance index to lowest so that we do not remove the wrong item.

  • After the Loop Body pin you need 2 new int variables, one that holds the index of max value and one for the max value. This works without saving them in variables but now we don't have to run the Max Of Int Array function over and over.

  • Now's the time to save the transform if you need to. The Instance Index input should be connected to the Max Value.

  • We can now remove the instance, instance index should once again be the max value int.

  • Now this is important: if we do nothing, the "Max Of Int Array" is going return the same value we just used, meaning we could possible remove a wrong item over and over. But if we remove it, once again since we are working with an array so we can't just remove it. That would resize it and not all the items would be processed. We use the Set Node Elem for our int array, its index should be the "index of max value" and we set it to -1 to ensure it will not be caught as a new candidate for "max of int array".

  • The Loop body is now done as far as removal of the correct item goes. But maybe you still want to do other things like "add instance".

  • However, the last thing we should do is after the completed pin of the for loop, clear the int array.

I have now learned that if I need to remove more than one item from an array, think about it some.

more ▼

answered Sep 26 '16 at 10:24 PM

avatar image

ste1nar
68 8 13 18

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Mar 18 '17 at 01:58 PM

avatar image

FrederickD
96 2 5 9

avatar image FrederickD Mar 24 '17 at 10:53 PM

It seems the RemoveInstances node is only available for the hierachical instanced static mesh component

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question