MoveTo always fails

Hey guys. I had a large character set up in my game, where it chooses a random vector in a reachable position and moves towards it. Suddenly, one day, the whole thing stops working. I can no longer even simply do a “Move To” on its own in a behavior tree without it failing. The only thing I did when all the AI in my game stopped working was to move the level closer to (0,0,0) in world space. However, I don’t think this should’ve been a problem as I moved the NavMesh, even replaced it and also re-entered the character into the game.

I’ve set up a simple MoveTo (With the player as the vector variable) and it will not work. I’ve tried going into the project settings and enabling BTAITasks, which doesn’t work. I’ve also ticked the MoveTo nodes checkbox “Ignore restart self”.
I’ve made sure the service providing the player location is working too.

I’m stuck. It’s really demoralizing to see that I can not continue with the AI of my game until I get my head around this problem.

Do you see the nav mesh in the editor when you press P?

You moved the NavMeshBoundsVolume with the world as well right?

Since you mention the character is large, was the size adjustment made when he broke? Or have you adjusted any layer settings. He may not be finding an appropriate nav mesh layer for his size.

Under project settings, Navigation system, does he have an agent type appropriate for his size?

Are there any navigation related logging messages when you call the move function?

1 Like

Also press the apostrophe key(Shift+"), as per

to enable the AI debugging overlay to see what it says next to “Nav Data”

Thanks for answering. I did replace the NavMashBoundsVolume with a new one, even though the previous one was unedited (Just placed in and resized). And when I press P the Navmesh is visible.

When I press the AI debugging hotkey, however, it says “Active task: none” and the behavior tree task is flickering at the bottom.

302480-activetask.png

That seems suspect. When he is actively moving, the Active task should reflect that task. Seeing that none suggests the task is failing immediately.

If you are running the project from the debugger I would put a breakpoint in UBTTask_MoveTo::ExecuteTask and step through it to see what is happening.

How would I do this? I’m not too experienced with using debugging.
And also, what would I need to adjust to make the NavAgent better suited to the size of the character?

How often is he twitching? Does he twitch in animation or actual movement? Is the Behavior tree Task oscillating on/off? Are you sure you aren’t seeing any log outputs?

If he is actively moving, the move should be his active task and he shouldn’t oscillate off of it. It’s possible to set up parent tasks in such a way that they keep interrupting the move task, so try ruling that out.

In terms of debugging, provided you have visual studio and such installed, you should be able to generate project files from the uproject and open the .sln file in visual studio, and hit F5 to launch the editor in debug mode.

I think the most frustrating thing is that it worked perfectly before. I’m not sure whats happened. I might try updating to 4.25 tomorrow and see if that fixes any bugs. Thanks for your input on this problem :slight_smile:

Okay, I have an update. I’ve messed around with the project settings and have got my character to initiate the MoveTo. However, he is constantly twitching as he moves which also makes him slow.

In the debug it states that the action is MoveTo, and the behavior tree is not flicking. It just the movement which seems very twitchy. Probably twitching each frame.

That’s wierd. I’m not sure what could cause that. I’ve not tried to set up such a large creature on the navmesh so I’m not sure what else might be causing an issue. Maybe try reverting his capsule back to default size just to see if there is any difference in behavior. What is his speed set to in the his CharacterMovementComponent?

This is probably worth adding to this discussion. I am currently on 4.24.3. I hadn’t looked at my AI for awhile then I realized none of my mobs where moving. the B-Trees were running but they just stood there. After a bunch of testing. I deleted the NavMeshBoundsVolume and RecastNavMesh Objects from the level and dragged in a new NavMesh Bound Volume. They started moving again. It MIGHT be related that I had upgraded from 4.19 through to 4.23 over the years and something got messed up.

i had the same issue. it resolved it by turning off simulate physics for the AI. can’t tell what exactly was the problem though.