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"

Bot (AI tree) Won't move to target waypoint

Hey there. I'm new to making AI in Unreal 4. I was following this youtube series for basic ai. https://www.youtube.com/watch?v=UrSxEtOOHy8

I can't seem to get the AI to move to the waypoints i've set in the level. My bot character is set to use my Ai controller in the class defaults. I've tried spawning and placing the bot in level, but it doesn't seem to make a difference. My nav mesh should be ok, i can see it normally highlighted with green on the level. The series is pretty old, so i'm guessing that some of that info is dated. Here is a screenshot of my behavior tree in action.

alt text

The correct way point seems to be setting, but i doesn't seem to go into the "move to route" task at any point. Any advice would be greatly appreciated, thanks for your time in advance.


Product Version: UE 4.17
behaviortree.png (197.8 kB)
more ▼

asked Dec 18 '17 at 03:07 PM in Blueprint Scripting

avatar image

283 9 19 24

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

2 answers: sort voted first

Try removing the decorator from the MoveToRoute node. What's that for? If you're trying to wait until FindRoute is done (and a location has been set) then that's not how to do it. FindRoute should not call the "FinishExecute" node until it's finished doing its thing. Tasks get ticked like actors so you they can wait until it's time to finish. Hope that makes sense.

more ▼

answered Dec 18 '17 at 03:23 PM

avatar image

4.5k 32 79 42

avatar image Samuelb Dec 19 '17 at 11:37 AM

Thanks for the answer, i'll give it a shot and report back!

avatar image Samuelb Dec 19 '17 at 11:48 AM

I removed the decorator, it seems to be executing the move to function, but the ai character does not physically move to the location.

here is a quick video of the ai tree now in action https://youtu.be/PliQPhrVwZI

avatar image Jin_VE Dec 19 '17 at 12:07 PM

Debugging the MoveTo is a pain... Make sure the location is somewhere near the NavMesh and the NavMesh is positioned properly relative to the floor. You can visualize the AI by hitting the ' key while in the game. Then the numpad keys enable/disable different aspects of the AI.

avatar image Samuelb Dec 19 '17 at 12:10 PM

OK I removed the event begin play execution from my bot character, as the bot is based of a playable character i made. Something in that code was preventing it from physically moving. Now the bot is moving to the first way point.

Edit: Adding the decorator back seems to break, something is not right with my decorator (UpdateRoute)

avatar image Jin_VE Dec 19 '17 at 12:16 PM

Looks like you don't need it. You just need to set the location and then move to it. Does the decorator make sure the location is good? If so, you should handle that differently (as I said before). If you can't get a good location then the failure is in the task that tries to find it (FindRoute). There you can finish execution with success set to false. At that point the BT will fail up the tree and the MoveTo will never get executed.

avatar image Samuelb Dec 19 '17 at 12:21 PM

Ok thanks for the good info, I was just following the tutorial and that's how he implemented it. The Ai i'm making is for a fighting game, so im not even sure if making way points is a good way to implement the movement patterns. What i really want is for the Bot to make decisions based on how the Player is moving and acting. For example if the player is moving closer the bot will move to a "saver" position, if the player is attacking the bot will dodge or try to counter the attack.

avatar image Jin_VE Dec 19 '17 at 12:26 PM

No prob. Doing that kind of thing is a lot more complex. I suggest getting comfortable with the system. Plus, once you get to a certain level of complexity, it's hard to avoid C++. Moving around can be done better using EQS. There's a good tutorial from Epic on that (https://youtu.be/NZZtMNdJk5o). And be careful which tutorials you watch. Some of them are learning as they teach so they aren't the best examples. GL out there.

avatar image Samuelb Dec 19 '17 at 12:34 PM

I'll be sure to check that tutorial, thanks again. I've been meaning to start c++ with unreal, as i know how to code c++. However for this project i've just haven't had the time to dive in to it yet. Thanks again and have a awesome christmas =) ps. the link seems to be dead

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

Hey there, if it's getting stuck on Find Route then you either dont use Finish Execute node on the task or the decorator you have on the MoveToRoute is always failing. Can you show me the decorator condition code?

more ▼

answered Dec 18 '17 at 03:49 PM

avatar image

6k 163 130 305

avatar image Samuelb Dec 19 '17 at 11:48 AM

Actually I now realized that the condition check is no longer the same in 4.17 than in the tutorial. What is the current method to set the condition for a decorator? (In the screen cap i'm not currently doing anything with the condition check.) alt text

alt text

(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