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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Why doesn't my AI reach its goal destination?

I've some AI that have a behavior tree. They run about picking different targets and use a "simple Move to location" to navigate to them. I have a raycast for debugging that draws a line from their location to their target move location. The moves can move them around 20,000 unreal units in both directions. The terrain is relatively simple. Just a few gentle hills. no crazy angles. After they have moved around for a moment they tend to get stuck. It generally happens around completing one full move to 4-5 moves. But eventually they just stop. I can see in the behavior tree that the move branch is firing. I can see the blackboard value reading "moving" and I can go frame by frame watching the behavior tree seeing that it is in fact firing the correct branch and they should be trying to finish their move. However based on all of their path traces that I trace draw. I can see they have just stopped mid-move and loop this branch of the behavior tree. Now I'm sure I can just throw in a condition that will jump start them when they breakdown but I've explored what preciously is causing this and I cannot figure it out. I've also tried using Move to location over the "simple" version and it also produces the same effect. Again, I can see by the traces that their targets are perfectly sitting on top of the nav mesh and they should just continue to walk towards their target. But they just stop after a few goes. It looks like they just run out of rope. Is there something about long moves that causes this to happen?

Product Version: Not Selected
Tags:
more ▼

asked Apr 28 '14 at 09:33 PM in Blueprint Scripting

avatar image

Thumper
966 141 150 389

avatar image Alexander Paschall ♦♦ EPIC Apr 28 '14 at 10:14 PM

Hey Thumper,

I am looking into this issue. Could you post a screenshot of your Behavior Tree's setup? Also a screenshot of your Task that gets the location will help.

Thanks!

avatar image Thumper Apr 28 '14 at 11:17 PM

alt text

smtex_a.jpg (52.9 kB)
avatar image Thumper Apr 28 '14 at 11:17 PM

alt text alt text

smtex_b.jpg (75.9 kB)
smtex_c.jpg (90.8 kB)
avatar image Thumper Apr 28 '14 at 11:17 PM

alt text

alt text

smtex_d.jpg (140.3 kB)
smtex_e.jpg (163.6 kB)
avatar image Thumper Apr 29 '14 at 05:41 PM

I've taken this further now and created something to jump start them if they get stuck, unfortunately, they stay stuck. The example above is a simplified version. All that is happening is I'm swapping out a tag to move from one task to the next. Each decorator checks to make sure the tag says the name of the task. If it does then the task is executed. It's pretty basic. To jump start them I created a service that checks every 3 seconds to see if the distance from their current location to the target is the same as it was 3 seconds ago. If so then I swap the tag from Moving (the task they are currently stuck on) back to Idle, which then gets a new target, and then checks to make sure that target is more than 100 units away, then it fires "Moving" again and they should start moving towards the new target. With the jump start they will occasionally come back to life and move towards their new target but, they will get stuck again and sometimes it will not be jump startable. Even though I can see the tag's shuffle back to idle, and all the following tasks get executed. I can even see the trace to it's new target update - yet it remains still.

avatar image Thumper Apr 29 '14 at 08:08 PM

Using just "Simple Move to Location" fixes the problem, but it's not what I was trying to do. Using that move forces the pawn to immediately turn the direction of the new target and begin moving. So to counter this I have a point that sits out in front of the AI, it's the forward vector and the right vector added together which produces a diagonal line out in front to the right. I then Dot product this to get the appropriate left or right diagonal and use VInterp to blend between the point out in front and the newly created diagonal point. This allows the character to move more smoothly. It appears that this VInterp is causing the problem, I'm guessing this is just my fault - some bug I'll have to find.

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

1 answer: sort voted first

I believe I have found the problem with this. Simple Move To Location must have built in "Pathfinding", because when I switch that node for "Move to Location" and disable "use pathfinding" on the node my problem goes away. I'm guessing that by teathering the AI to a point out in front that blended either slightly to the left, or slightly to the right. I think it would square up with what the pathfinding was wanting to do and essentially lock or clamp as they opposed one another.

more ▼

answered Apr 29 '14 at 08:47 PM

avatar image

Thumper
966 141 150 389

avatar image Alexander Paschall ♦♦ EPIC May 03 '14 at 08:42 PM

Hey Thumper,

Sorry for the late response. I am glad to see that you discovered a solution. You are correct, the "Simple" Move To nodes in blueprints use pathfinding via navmesh. Would a "Move Directly Toward" task in the BT work better for you? It will ignore pathing for movement like the Move to Location. Let me know if there is anything else I can do to assist you.

Cheers!

Alexander

(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