When you say, "it breaks enemy to player damage", *how* does it break? Is damage not making it to the player due to unwanted collisions or something?
Since you don't specify, I'm going to assume you're using Unreal. If you're not, then this will be slightly less useful, but it's probably similar in other engines. Unreal's collision system is pretty flexible, but also pretty confusing without banging your head against the wall a bit. One of my favorite pages related to Unreal collision can be found here:
The gist is that when setting up collision in Unreal, you're building a contract between different object types for how they respond to one another. Ignore, Overlap, and Block are the options, and when two objects, A and B, enter the same space the engine will select the least blocking interaction based on the combination of the rules you've set up for A vs. B and also B vs. A. For your project, you will almost certainly need to create custom object types so you can create accurate rules about how those object types collide, or don't collide, together. For the example you give, it sounds like the collision sphere you're testing with may be set up so that enemy damage collides against it, when that's not what you want. The collision sphere needs to ignore enemy projectiles/hits, while overlapping enemies to be able to test against which is closest.
I suggest spending some dedicated time reading the Unreal docs and testing out collision scenarios outside of the mechanics of the game itself. If you can get test objects behaving the way you want in isolation from the rest of your project, it can help simplify the complexity while learning how it all works.
Two questions:
What engine are you using?
When you say, "it breaks enemy to player damage", *how* does it break? Is damage not making it to the player due to unwanted collisions or something?
Since you don't specify, I'm going to assume you're using Unreal. If you're not, then this will be slightly less useful, but it's probably similar in other engines. Unreal's collision system is pretty flexible, but also pretty confusing without banging your head against the wall a bit. One of my favorite pages related to Unreal collision can be found here:
https://www.unrealengine.com/en-US/blog/collision-filtering
The gist is that when setting up collision in Unreal, you're building a contract between different object types for how they respond to one another. Ignore, Overlap, and Block are the options, and when two objects, A and B, enter the same space the engine will select the least blocking interaction based on the combination of the rules you've set up for A vs. B and also B vs. A. For your project, you will almost certainly need to create custom object types so you can create accurate rules about how those object types collide, or don't collide, together. For the example you give, it sounds like the collision sphere you're testing with may be set up so that enemy damage collides against it, when that's not what you want. The collision sphere needs to ignore enemy projectiles/hits, while overlapping enemies to be able to test against which is closest.
I suggest spending some dedicated time reading the Unreal docs and testing out collision scenarios outside of the mechanics of the game itself. If you can get test objects behaving the way you want in isolation from the rest of your project, it can help simplify the complexity while learning how it all works.
https://dev.epicgames.com/documentation/en-us/unreal-engine/collision-response-reference-in-unreal-engine