x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

alt text

Product Version: UE 4.21
Tags:
more ▼

asked Jan 10 '19 at 05:43 PM in Blueprint Scripting

avatar image

L11777
2 1 2 3

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.

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Jan 10 '19 at 06:02 PM

avatar image

gstyczen
41 1 8 6

avatar image L11777 5 days ago

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.

(comments are locked)
10|2000 characters needed characters left

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

untitled.png (145.7 kB)
more ▼

answered Jan 10 '19 at 09:48 PM

avatar image

dabs863
66 3 6

avatar image L11777 5 days ago

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.

alt text

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

(comments are locked)
10|2000 characters needed characters left

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.

https://www.youtube.com/playlist?list=PLyu-W38DvZhqByAoeva1jewB5s78zQHIy

alt text

casting.jpg (210.9 kB)
more ▼

answered Jan 10 '19 at 10:20 PM

avatar image

Nebula Games Inc
3.1k 18 8 13

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question