MoveTo in behavior tree not moving AI character

Hey everyone,

This is my first post and I have a fewf questions. I ran into this issue with moving AI characters. Originally I had two different AI characters. One from the UI Kit which would shoot my character with a fireball and guard an area and one that was a child of my character and moved using blueprints. They worked as intended when I first made them I basically just drag and dropped them in my level inside a navmesh volume and left them there. I moved onto adding other things into my game and they stopped moving randomly. The UI Kit AI senses me and turns to shoot me but he will not walk anywhere anymore. The child AI does not do anything either.

I ignored it until now when I decided I would create a new AI character using the Behavior tree and blackboard. The first issue I have with this approach when using GetRandomPointInNavigableRadius if I set the radius to anything under 9300 the vector I get as random all x, y, and z points are 3.4x10^39 which is definitely not correct. If I set the radius to 9300 I seem to get reasonable values but z is always the same. This is the first question shouldn’t this work regardless of the radius? Most tutorials and stuff say to use around 2000. Also, my nav mesh is not covering my whole level just a section and I checked if it is making the terrain green with ‘p’.

Next question is the Behavior Tree seems to not even run MoveTo or it is failing I have no idea which one or how to check. I have a wait task after MoveTo which never gets called because of this. Is there a way to debug this? its pretty frustrating especially since I am pretty new to unreal engine.

Everything is simple as possible created a new character blueprint using the unreal mannequin mesh, assigned my created AI controller class to it that runs the behavior tree on begin play, Behavior Tree has a sequence first created task is FindRandomLocation, next is MoveTo, then Wait. The FindRandomLocation just gets the actor location, next getRandomPointinNavigableArea, then assigns that to the blackboard.

I have tried for hours trying to figure out whats wrong and its probably very simple please help Thanks.

MoveTo will only work if the location is valid. I had one instance when the z number meant the location was under the floor, so MoveTo wouldn’t work. (SimpleMoveTo would sort of work, but only because it didn’t try to understand that the location was unreachable until it got closer). The fact that your Wait task never gets fired makes me think that is the most likely solution, because the MoveTo never returns true, because your character never gets to the location.

On top of that, it sounds like your random number generator might be bugged. Can you post the screenshot of the blueprint? You need to try another random number if the current one is invalid, or maybe it is generating non-random numbers.

You could also check that the location is within the nav mesh volume, or try increasing the distance that the character has to approach the location to register as successfully getting there.

This is my FindRandomLocation task for my behavior tree. I am not manually randomizing the numbers.

I figured out what the problem was and I am not happy about it because it took me more time then I care to admit to find it out. So when you click ‘p’ and it highlights the walkable surfaces it creates a RecastNavMesh in the world outliner. I deleted this and created a new one by clicking ‘p’. I guess it got corrupted for some reason and made it unwalkable for AI. Makes no sense to me but Thanks for your input anyway.

Well done, and good luck! (And don’t forget to mark this as answered).