2
\$\begingroup\$

I try to move a character with AI MoveTo, but it always fails. I tried to do this with a standard ThirdPersonController and a custom one. The blueprint is simple ThirdPersonController

When the event happens, it starts printing "failed". I checked many times if I have a NavMesh on the level or any other problems with it, but I don't think there are any problems with that. Any ideas?

\$\endgroup\$
4
  • \$\begingroup\$ Is your character possesed by AIController? \$\endgroup\$ Commented May 18, 2020 at 20:19
  • \$\begingroup\$ Does it have a valid movement component? \$\endgroup\$ Commented May 18, 2020 at 20:19
  • \$\begingroup\$ Yes and yes. I double-checked \$\endgroup\$
    – stdnik
    Commented May 18, 2020 at 21:34
  • \$\begingroup\$ Try to open an output log and see if there is something that tells you why is it fails \$\endgroup\$ Commented May 18, 2020 at 22:10

8 Answers 8

1
\$\begingroup\$

There's a few things that can cause this. Also, yes, it's normal to be frustrated with the AIMoveTo node, as it can be finicky. Your AIMoveTo node does not have a destination. Instead, try to drag off the As First Person Character and get the actor's world location. You should try inputting that into the Destination field on the AIMoveTo node.

If this doesn't help, make sure your AI pawn is possessed by AI (you can check this in the class (self) details under a field called Auto Possess AI.

One more thing, is the OnSeePawn event firing? It might be having issues seeing you.

I'm assuming the issue is the destination field, though. Keep me updated with this! I want to make sure you get this resolved.

\$\endgroup\$
1
  • \$\begingroup\$ I connected the print string node to Ai Move To the "exec" out pin and I send there the "Movement Result" from AI Move To. Each time I launch the game when this pawn starts seeing me, it prints "success" once and then starts spamming "aborted", but the pawn doesn't move. I've checked everything you mentioned and everything is alright there. Could it be that I have some kind of bad project or map configuration? I've tried moving, removing and adding again the navmesh, but nothing changed \$\endgroup\$
    – stdnik
    Commented May 19, 2020 at 20:09
1
\$\begingroup\$

Long story short: there was some problem with the map, so I just started using another one. Don't know what caused the problem, but it was definitely in the map.

\$\endgroup\$
1
  • \$\begingroup\$ Hello! If this fixed the error and is the solution to your issue, please consider marking the answer as the accepted one :) \$\endgroup\$
    – Vaillancourt
    Commented Jun 19, 2020 at 0:05
1
\$\begingroup\$

I had the same problem with my project. Suddenly my AI stopped working.

By just selecting the nav mesh volume and changing anything(like a minor adjust in x scale, for example) made it work again.

Maybe Nav Mesh need some kind of refresh after some change in the project.

\$\endgroup\$
1
\$\begingroup\$

I had the same exact problem. I killed the NavMesh, deleted it, and deleted the NavRecast. The recast returned automatically, I made a new NavMesh and that did it.

\$\endgroup\$
1
\$\begingroup\$

Assuming that you've set everything up correctly and it's still failing; your Target Actor HAS to be in contact with the navmesh otherwise it will fail regardless of whether the move was successful or not.

I was having the same issue, and actually, what the problem was for me was that I was using a target point actor for the location my AI should move to, and it was in the air (247 units above the ground) and not touching the navmesh. So, it was arriving at the target, then getting confused and then failing after a few seconds, even though it was actually AT the target and the acceptance radius was 300. All I did was move the target point to the ground (pressed END with the target actor selected) and it immediately fixed the issue. So it will register as a fail if the move to target isn't connected to the navmesh even though it did technically walk to the target you specified.

\$\endgroup\$
5
  • \$\begingroup\$ And of course, the navmesh path builder puts a big hole around the actor in question making it difficult for the actor to contact the mesh. \$\endgroup\$ Commented Nov 10, 2023 at 4:31
  • 1
    \$\begingroup\$ To fix that, there's a setting in the default properties "Can ever affect navigation". If you set this to false, you won't get the issue with the hole in the navmesh. Also, actors without collision won't give you the hole. For example, I turn it off for doors so that ai can always walk through a doorway. Alternatively, you can just increase the radius for the target so that it will consider the move completed sooner. \$\endgroup\$
    – TorQue MoD
    Commented Nov 10, 2023 at 8:22
  • \$\begingroup\$ That "Can ever affect navigation" setting is insane! I've struggled with those holes ever since starting UE a year ago. People were like adjust the radius, etc. That was so inefficient. UE has these little caveats that if you just know about them save you so much, but not knowing is so frustrating - haha. One more tool for my belt. Thanks so much! \$\endgroup\$ Commented Nov 12, 2023 at 2:24
  • \$\begingroup\$ Actually, I'm finding the AI can now get stuck trying to move through the mesh instead of going around it because of that flag. \$\endgroup\$ Commented Nov 12, 2023 at 2:44
  • \$\begingroup\$ It would depend on your collision. If the mesh doesn't affect navigation, then the AI doesn't even know its there. So you need to make sure the collision is built in a way that is easy for the AI to move through. Those gaps in the navmesh are there to tell the AI that there's an obstacle that it needs to avoid. You can also adjust the size of those gaps by adjusting the Agent Radius. Here's some links for you: forums.unrealengine.com/t/change-the-precision-of-the-navmesh/… and docs.unrealengine.com/5.0/en-US/… \$\endgroup\$
    – TorQue MoD
    Commented Nov 12, 2023 at 6:25
0
\$\begingroup\$

One solution I found actually had to do with the RunPhysicsWithNoController boolean in the CharacterMovementComponent. I spawn my AI from the gamemode to populate servers that are below max player count, and I found that having that boolean as true keeps the character from moving.

\$\endgroup\$
0
\$\begingroup\$

I had the same issue for a few days and I just fixed it. If you're interested the issue was that RecastNavMesh had Runtime.CanBeMainNavData turned off by default, when I turned it on the AI started to move again. I hope this will help anyone.

\$\endgroup\$
0
\$\begingroup\$

No one actually says this but you actually must have a navMeshBoundsVolume in your scene that overlaps the Actor/Pawn AI so that it moves where you want it to move.

I had the same issue and fixed it by adding a navMeshBoundsVolume to my scene.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .