How to check if actor is overlapping another blueprint actor's component?

I have two actors, one if the player character, the other an NPC. The player character has a large sphere around them, and I need the NPC to check that it is overlapping with a component of another actor. I know I need to do a cast to the player character from the NPC and that later I need to check the overlap, but how do I get a reference of the player character’s sphere component in-between these two commands?

How do I get a reference of the player
character’s sphere component

There are GetPlayerCharacter and GetPlayerPawn nodes. Then you cast it to your class and get the component you want.

Drag off the output pin from the first person character cast and search for “get sphere”, if it has a sphere component it should come up in the options menu. Other than that the below answer is how you create the input object reference to the player character.

Could you show me an example of how I could use that? I don’t see how it applies to this context, or really at all.

EDIT: actually, no, this is not a good example to follow by at all, primarily, because this does not apply to normal blueprints, just whatever you define as the player or the sort.

for me i put a sphere on my npc and then on collision casted to my char but try but highlight your sphere and then right click on the graph and at the very top under search bar you have 2 options a add or a call under call open the collison and go down to is overlapping and get it and just check if your overlapping the npc

I want the capsule of the NPC actor to detect overlap with the player character’s sphere. I tried this setup, but it doesn’t work; at no point does the character enter the “Not Moving” state, but it does stop moving when it collides with the sphere, though the movement animation never stops playing until the NPC’s capsule collider is colliding with the player’s collider capsule, but it should be player’s overlap circle to do this instead. I’m using AI Perception too, so I don’t know if it’s because of that that I can’t get this to work properly.

Can a collision object not also detect overlapping? Just one of the two?

You need a reference as @gstyczen said, it is something that applies to “normal” BPs. Here is what we are talking about friend. If you need more help understanding the process of casting and its uses this tutorial might be helpful for you.

1 Like

once you obtain the overlapping actors, how do you select one and do something to it? I don’t know how to grab a single actor from the array