Download

Simple Move To Actor not working for Ai Controller

The set is up is extremely simple. In the AI controller there is a Simple Move To actor, which is assigned player controller 0. This had worked plenty of times the day before just fine. Came back the next day and with no changes the game refuses to do a single thing. The AI will no longer move during run time, and print string refused to work until I restarted it on the fourth time. I know the move to is being fired, if I add a destroy actor on its pawn it disappears. And the nav mesh is there fine. I’ve even deleted the nav mesh, and made a new controller and character for it from scratch with no use. Although starting a whole new project from TPP template works fine with the exact same things. I just don’t get it, and its becoming extremely frustrating. I don’t want to lose days of work over some stupid bug. I would add a pic, but its literally just 4 nodes. (Event begin play, Move To Actor, Self reference for controller, and get player controller 0 for target actor)

Are you doing this within a GameMode class?

If so, make sure your using that particular GameMode.

No, this is done inside the AI controller. It can run other things, but any sort of movement will not work.

I know this might be a stupid question but your level has a NavMesh?

1 Like

It did. I started a whole new project and migrated everything and I can get simple move to to work again. But the Move To task in the behavior tree still will not work. Yet if I manually make a BTT that uses a simple move to location using the same vector variable, that will work. But the basic Move To in the BT will not, using the same data. I really don’t understand why this would not work. It seems an extremely simple set up I’ve done dozens of times before…

Sounds like a nav mesh issue, press “p” to show the nav mesh. Should be bright green by default. If not go to modes and drag in a new nav mesh box and scale it up around your area.

The nav mesh bounds are there. But I deleted it and made a new one just in case it got bugged 4 times in a row, but still no go. I can only get the AI to move with a Simple Move To Location node with a vector, both in the controller and withing a BTT. But it will not move with a BT move to task. If I put both, using the same BB variable, only the BTT one actually works. If I change them to use Simple Move To Actor, none if it works. The only way Move To Actor works is if I use Get Player Character (0), it won’t work with any way I use the BB object.

So after these hours of testing today and all day yesterday, it seems the AI can’t use any sort of Move To, either in the BT or with nodes, for things I set in the Blackboard with BTTs. In the tree during play, it shows they are set to what they should be, yet none of the moves are able to actually do anything. If I set the vector for instance within the controller, the Move To nodes work in the BTT and he goes there. Although the Behavior Tree MoveTo task won’t. But if I set the same vector location using the same code in a BTT instead of the controller, even the nodes will not move him. Although I can see in the tree the vector is indeed set in the BB, there is absolutely nothing to get him to move. The move to PASS in the sequences, but he didn’t actually move. So it maybe seems sort of bug o something to do with the Blackboard data maybe? Because there is literally no other reason Move to location vector would only work when set from one location, but not in others. Its the same data being passed the same way.

If anyone can help shed light on this, it would be appreciated. I literally can not continue my project with this bug/error still there.

Couple things i think it might be.

  1. are you using AIMoveTo not just move to location/pawn.

  2. your target vectors wants to be the players current character/pawn rather than controller, this shouldn’t really make a difference but its better practise imo.

  3. double check you have assigned the variables for the blackboard keys in the tasks, decorators and services in the actual behaviour tree, I’ve been stuck so many times and its because i forgot to check these.

  4. The target vector might not be reachable by the current pawn because it is too high or blocked. A good way to test this is to drag out the movement output node on AIMoveTo and it has a bunch of options, you can log these out to see exactly whats happening.

  5. check in the AI character/pawn that the auto ai possession is set to spawning and placed in world

Thats all i can think of off the top of my head without screenshots, hope this helps.

2 Likes

There’s a couple of things that i think it might be:

  1. Make sure you use AIMoveTo rather than Simple Move To.

  2. Are you placing the AI in the level or spawning it, as this effects it you AI auto creates a AI controller. This is set in the AI Character/pawn under ‘Auto-posses AI’ i think. make sure its set to placed in world and spawned.

  3. Check you have assigned the blackboard variables for your tasks, decorators and services in the Behaviour tree, I’ve forgotten this step so may times and thought it was some other problems until i checked them.

  4. make sure the target vector is reachable, its always best to use the players current character/pawn as the target instead of the controller. You can check if the target is reachable by dragging the movement output from the AIMoveTo node, you can use this to debug if the path is blocked, unreachable, cancelled and a bunch of other stuff.

Thats all i can think of for now without screenshots of the problem, hope this helps.

Thanks for the suggestions! Although I went through them and none of them really worked.
For 1 I did switch to the AImove node, it seems better.
For 2, I’m actually trying to send the AI to a rock, which there are several in the area. So in the BTT FindNearestResource I run a get all actors of class, then pick one and save it as an actor in the BB. If I try the BehaviorTree MoveTo task, it won’t go. So I have my own BTT MoveTo where I run the AiMoveTo, although it still didn’t go. But now with the enum I can see that it aborts every call, but I’m not sure why.
For 3, I can see after I start the game in a window and Alt+Tab out that the Behavior tree runs like it should. Although there are only 4 nodes. I call a sequence of FindNearestResource, then the BTTMoveTo with a decorator to only run if the BB key is set, and that always passes, and I can see down in the corner that it is set to the right boulder. If this branch fails it runs a wait, then tries again.
For 4, it seems the vector should be reachable. I’ve had it in other projects before where it could go to the same model before. And even if I set a specific vector in a BTT that I know it can go to, it still fails/aborts.
For 5, The ai is being possesed correctly because occasionally the AI can move around if I test it and tell him to just go to my character. :confused:

Cant believe I forget the Nav Mesh…DOH!

I’m glad these forums are here!

I suspect the problem here might be that the AI needs some kind of delay induced for the MoveTo node to trigger. I spent half a day with AI char that was not moving and the problem was that i was trying to build it around Event begin and it could not complete every request in time and so did nothing.

Maybe it have something to do with your AI’s movement component?

Hey, I know this is old, but I had this issue and figured it out. I had to delete the “Recast Nav Mesh” actor and then rebuild the paths. The new one generated seems to work better.

2 Likes

I met the same problem and finally solve this by changing the default land movement mode to fly

Jacob777 you saved my life thank you so much

I have the same problem. Only Simple move works (I guess this is not using navmesh)

  • Nav mesh is present and green on most of the places of the landscape.
  • Setting character movement to flying, doesn’t help either

I am suspecting the character actor may have some setting wrong or landscape. But navmesh shows green, when pressed P, and even putting character above the ground doesn’t help (if he would be stucked in the ground maybe)

I have this same problem – Navmesh is green, but running “ProjectPointToNavigation” or “GetRandomReachablePointInRadius” inside a Behavior Tree Task ends up not finding anything.
Similarly, MoveTo in the Behavior Tree immediately finishes.
It behaves approximately as if there is no navmesh, but clearly it’s there (green area all over my level) and the coordinates used match very much points that are on or above the navmesh.

The really annoying thing is that I think I had this problem before, but I can’t recall if I found a solution or not. And the current project is blueprint, not C++, so setting up stepping into the engine will be more annoying.