Multi Sphere trace detecting same actor more than once?

I have 4 enemies around me, and when I press a key the code is meant to multisphere, find these 4 enemies and add them to a array. Somehow, each one of them is being added more than once, as I print the length and it returns 3 times more the number of enemies.

Product Version: UE 4.9

How about a Check if the Actor is already in the Array before adding him.

Maybe a ForLoop after the trace with a print string can tell you what you are hitting each time, then you can narrow it down. I had this problem not too long ago with a character of mine returning almost every part on it as a hit. I ended up setting all the extra body parts to the NoCollision preset and having collision turned on for just the CapsuleComponent. Solved my problem thanks to help from here.


I could be wrong on how the print string would work there, but something along those lines seems like the way to find the issue.

For the past 2 hours I’ve been fiddling around with a duplicate BP and it seems the collisions I have inside of my Enemy are detected as an object as well? I can confirm this as when I delete them only 1 object is detected.

It seems the problem is the collisions inside my Enemy, they are considered as an extra enemy for some reason… have been looking at the differences between a collision of a different enemy that has a collision but is not recognized in the sphere trace and my current enemys collisions and they have exactly the same boxes ticked. Still wondering what I’m doing wrong. Tried to add the collisions to actors to ignore, but collisions are not actors…

When I had my problem, my line trace was detecting all the different components in my character. I printed the results to the screen and ended up with this:


So what I ended up doing was setting all of the extra components to NoCollision under the presets for collision, and the capsule component was set to Pawn and Mesh was set to CharacterMesh. I also made sure that the component tree was in the right order. It worked fine after that. I only get 1 collision now when tracing it.

The issue is that I need those collisions to be active, however I managed to discover that spawning them inside your character instead fixes the issue. Thanks anyway.

Glad you fixed it. Good luck!

Many thanks! :smiley:

Pls help me im having the exact same problem, what do you mean by “spawning them inside your character instead fixes the issue.”