Download

Overlap event on Blueprint actor attached to character fires too often

Hello all,

Setup
I’ve create a Blueprint called BP_TestActor. Within BP_TestActor I’ve added a Sphere Component and setup the sphere to only overlap pawns as well as not be hidden in game (so I can visualize the overlaps). The BP_TestActor has an event of OnComponentBeginOverlap(Sphere1) enabled. From this I hooked up an authority switch (which works fine) then I cast the overlapping actor into MyCharacter and then adjust that characters HitPoints.

BP_TestActor-EventGraph.png

In myCharacter Blueprint I’ve setup a Begin Play Event which hooks up to a for loop and loops X times which in turn spawns BP_TestActor and adds it to an array. Then I have another for loop setup to loop through each spawned actor and attach it to the myCharacter Blueprint instance. This seems to work flawlessly as I see each character that is spawned (on the server) with the sphere component on them. I also have a tick event updating text above the characters head with their current hit points just as a visual reference so I know the moment the hit points change.

BP_MyCharacter-EventGraph.png

The Issue
When I run around on screen with the myCharacter the OnComponentBeginOverlap(Sphere1) event keeps firing. As soon as I stop running the overlap stops firing. If I walk into another characters sphere then it adjust HP correctly.
This does not seem to be related to any of the networking or server/client side code as I’ve tested this in single player and get the same results. It seems to have to do with attaching the BP_TestActor to the myCharacter. If I just spawn the BP_TestActor and move it to the characters location every tick, it works as you’d expect and does not fire as the character is running because they’ve only overlapped it once.

If anyone has any ideas why this happens, please let me know. Also please let me know if you would like further clarification.

Thanks,
Brent