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 do you make AI to stop following you after a certain distance?

alt textI've been trying to get my AI (using third person character blueprint) to stop following me after he's out of range of my pawn sensing but I can't figure it out. Any help would be appreciated! I can provide a screenshot of what I have so far if requested.

Product Version: UE 4.18
Tags:
screenshot-4.png (444.7 kB)
more ▼

asked Mar 16 '18 at 05:36 AM in Everything Else

avatar image

NoticeableScout
21 1 3 3

avatar image Nebula Games Inc Mar 16 '18 at 05:41 AM

Screenshot would be good

avatar image NoticeableScout Mar 16 '18 at 05:42 AM

on the way

avatar image NoticeableScout Mar 16 '18 at 05:43 AM

alt text

screenshot-4.png (444.7 kB)
avatar image NoticeableScout Mar 16 '18 at 05:47 AM

What's happening exactly is when my first person character gets in front of the AI's pawn sensing it starts to chase me but when I'm out of range of the pawn sensing it still chases me. The only way it goes back to patrolling is if you go around the back of it.

avatar image Nebula Games Inc Mar 16 '18 at 05:57 AM

Have you tried checking the box "stop on overlap"?

avatar image Nebula Games Inc Mar 16 '18 at 05:57 AM

And increase the "acceptance radius"? "5" is super small

avatar image NoticeableScout Mar 16 '18 at 05:58 AM

to which ones?

avatar image Nebula Games Inc Mar 16 '18 at 05:59 AM

try increasing the acceptance radius to something like 100 (i see your move radius is only 1200) first and see if that helps, on both AI Move To nodes

avatar image NoticeableScout Mar 16 '18 at 06:02 AM

The AI just seems to ignore me now that I set it to 500

avatar image Nebula Games Inc Mar 16 '18 at 06:04 AM

yea that was my bad, i didn't realize your search radius for random movement was only 1200....that is a comparatively large proportion so i changed my initial comment to acceptance of 100.

avatar image NoticeableScout Mar 16 '18 at 06:08 AM

I don't think that's the problem, it seems to just be making the distance in which the AI reacts farther. 5 seems good because it reacts when the character gets inside the pawn sensing radius.

avatar image Nebula Games Inc Mar 16 '18 at 06:05 AM

Also I just remembered, I think on pawn sensing in the details menu there is an option for "lose sight radius" i would check that out, it might be further away than you think

avatar image NoticeableScout Mar 16 '18 at 06:08 AM

I'll check that out

avatar image Nebula Games Inc Mar 16 '18 at 06:10 AM

nope, just looked, must have been a variable I made. So what you can do is set a timer and every like 1 sec or so, have it check the distance from player to AI and if greater than sight radius tell it to "roam"

avatar image NoticeableScout Mar 16 '18 at 06:12 AM

How would I do that? if that involves a behavior tree I can't do those ... :)

avatar image ThompsonN13 Mar 16 '18 at 02:27 PM

below ill post a picture showing the basics of the setup with a timer. if you use the setup in the pictures the timer will call the event checkdistance to player every 1 sec and will continue doing so. you may want to add in a way to stop the timer but this will get you started.

alternatively you could use ai perception for this issue as it has more options for when you want the ai to lose sight of and forget a target. below in the second picture is some of the options with ai perception.

alt text

alt text

capture.png (129.9 kB)
capture2.png (24.5 kB)
avatar image Nebula Games Inc Mar 16 '18 at 02:44 PM

I thought there was a "lose sight radius" haha couldn't find it but I remember it was there somewhere.

avatar image ThompsonN13 Mar 16 '18 at 02:51 PM

yup its in ai perception but not in pawn sensing. i dont know why theres still both at this point but i guess its just for legacy compatability

avatar image NoticeableScout Mar 16 '18 at 06:10 AM

I couldn't find "lose sight radius" in pawn sensing.

avatar image Nebula Games Inc Mar 16 '18 at 06:16 AM

no, nothing that crazy. Just use "Set timer by event" thats hooked up automatically to a custom event, call it what you like (Sight Check) whatever, from that get world location of player and AI, use a "get distance to" node and check the output against whatever your "sight" radius is in the pawn sensing. If greater than sight radius the player is too far away, AI should roam, so set "In Range" to false if that comparison is true.

avatar image NoticeableScout Mar 16 '18 at 06:33 AM

I've been trying to create this for a while and I can't figure out how to set everything up, this set timer by event thing is new to me.

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

0 answers: sort voted first
Be the first one to answer this question
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