Overlapping Actors problem

I have implemented 2 classes, Class A is the player character, and class B is an enemy that explodes when it gets close to the Player.

I am using NotifyActorBeginOverlap(AActor* OtherActor) events to achive this.

The situation looks as follows:

The problem is that since B explodes upon overlapping with A , and this is also triggered by the green collision sphere of A. I want it to explode only when its in radius of A (Once A is overlapping the blue sphere), excluding its collision sphere.

I can not disable Generate Hit events of A’s spherecomponent, because it needs the overlap events to help determine the closest enemy (sphere size changes dynamically based on proximity to closest enemy, if new enemy enters the sphere, change current target).

Is there any way to make this work?
Do i need to create a new actor for the A’s spherecomponent that follows A around? Isnt there a better way?

If I understand it correctly, you want the overlap only if A overlaps with the center of B. Just make a second small collision for B.

If you want it the other way round, give A another smaller sphere.

Hey! Thank you for your answer.

A collision is working as it should be, if anything enters the USphereComponent, A gets notified of the overlap.
The problem is with B. How B SHOULD work is that, it enters A’s USphereComponent without B getting notified of an overlap, and once it gets to the center of A it gets notified of the overlap and explodes.
Right now, B gets notified of overlap even if it overlaps with A’s USphereComponent (like the above image), and explodes far away from the player.

This is because im using NotifyActorBeginOverlap(AActor* OtherActor) for the explosion, and A’s sphere also triggers it.
Do i need to implement it with ComponentBeginOverlap instead? Or is there a way to make it work with ActorOverlap?
Another idea i had is to create a child actor from A for the USphereComponent, but maybe there is a better way?

You can work with collsision channels, create a custom component class and cast to it or give a tag to the component.
Only explode if the component matches.

You can also add the second small collision to A and if that collision overlaps with B, trigger the Explosion from A.

Oh! That makes sense. Thanks alot :)!