I am using Sphere collider to detect actor’s nearby enemies. When an enemy is within the sphere collider, the “Begin Overlap” event is triggered and when the enemy leaves the collider’s range the “End Overlap” event should trigger.
What I noticed is, even if the enemy actor doesn’t leave the sphere collider’s range, the “End Overlap” event is triggered.
What is the reason for this?
Thanks for your help.
Have you checked the actor in the end overlap? Maybe it’s some other actor leaving the sphere and not your enemy. Also, as far as I recall for components, overlaps are done per component, so if the enemy has multiple components that can overlap it could be one of the components going out of range.
Collider should be set to overlap the enemies capsule component, not an added component of the enemy. Capsule components on Pawns/Characters is the actual character. It’s what is moved and interacts with the game world.
If the actor is not a character or pawn you should add a collision component and use that to trigger overlap. Do not rely on Mesh collisions for gameplay functionality traces/overlaps. Use collision components.
Actors inside radius before the collider is initialized can at times be ignored.