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 can I control the distance between AI and player?

I'm very new to all this, but my question is as follows:

I have one AI that I want to follow the main character player throughout a level until they reach the end. There are often hallways and corners in this level and the AI is extremely close to the player to the point where the player often gets stuck and can't turn around.

I need to have the AI maintain a shorter distance between itself and the player but not sure exactly how to do this. I thought Acceptance Radius would do this, but it doesn't seem to do anything when I change the value. Either it simply will not follow at all or it will continue follow just as closely as it was before. There is no middle ground here.

Here is a picture of the blueprint for the Pawn Sensing for this AI character alt text

Product Version: UE 4.17
Tags:
blueprint.jpg (49.4 kB)
more ▼

asked Sep 08 '17 at 10:15 PM in Blueprint Scripting

avatar image

NathanHood
1 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

I've never used that node. You could do better with an actual AI Behavior tree to get more control.

A solution that may not be the best if that radius doesn't work would be to create a custom collision type in preferences. Call it "stop AI follow"or something. Put a collision sphere or box around the player at the distance you'd like the ai to stop at.

Put a sphere around the AI pawn as well make sure they can overlap each other and nothing else.

On component overlap, cast to overlapping pawn and stop its movement until its no longer overlapping.

more ▼

answered Sep 10 '17 at 02:54 AM

avatar image

thankstipscom
654 38 37 70

avatar image NathanHood Sep 11 '17 at 07:23 PM

This worked perfectly.

I did not create any new blueprints or change anything in my blueprints. I simply added a sphere around the main character player and the AI respects the boundary of the sphere. So much so that the main player can actually "push" the AI out of the way while still seeming to keep realism so there is no getting stuck in corners anymore.

Thank you so much for your advice!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Acceptance radius would work, it's just its measured in cm and 0.5 is incredibly small and may as well just be 0, try maybe 40 or 50.

more ▼

answered Sep 10 '17 at 08:24 AM

avatar image

16bit
329 7 8 12

avatar image NathanHood Sep 11 '17 at 07:24 PM

Thank you for your comment. I changed the radius to 40 and 50 and even higher numbers and it didn't seem to be any different.

I found my solution through adding a sphere around the main character player which helps tremendously.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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