# Why does my AI not move?

**URL:** <https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372>\
**Category:** AI\
**Tags:** ai-navigation, ai-move-to, ai-controller, unreal-engine, question\
**Created:** [October 24, 2015, 8:40pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372 "2015-10-24T20:40:59Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 8:40pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/1 "2015-10-24T20:40:59Z")

</div>

Hello,

I’m sorry if this is a common question that gets posted here, but I’ve tried following a lot of tutorials and suggestions made by others and they have not worked for me. In my project I have a trigger set up to spawn enemies which I already have implemented, but they don’t want to immediately move to my player on spawn which is what I’m attempting to do.

My Nav mesh is already set up, I’ve created a controller for the AI, and set up a behavior tree for them which I have posted images of my blueprints below. I replicated these blueprints from a colleague and have seen them work in his project. What I also don’t understand is that before I replicated these blueprints and put them into my project, just doing a simple move to actor to get the enemy to follow my character would not work. Hitting “P” also does not work unless I select the floor.

What’s causing my enemies to not follow my player?

 ![63977-navmesh.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/3/1637c1d750bc3200b221e38383b6006140c9e004.jpeg)

 ![63978-ai+controller.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/3/7b3d69ed61ef2a81bade6aa406e2f763dc454c78.png)

 ![63979-set+enemy+function.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/6/e/a6e80b4d2f21891277ac537a4f91b913f70645ba.png)

alt text

 ![63991-behavior+tree.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/8/c/58c1fb753fc44b19cf8efe103de500d2a73ff8b2.png)

---

<div class="post-metadata">

**Author:** ![Heoki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Heoki](https://forums.unrealengine.com/u/Heoki)\
**Post date:** [October 24, 2015, 9:01pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/2 "2015-10-24T21:01:35Z")

</div>

I am still learning about AI too but this is what I noticed looking at your blueprints.

In your spider controller’s set enemy it looks like you’re unsetting the enemy “value as object” when there is a new enemy, it seems like you want to set it to be the new enemy unless the “Update My Black Board Key” function does that.

Also, I don’t see anywhere that sets ‘IsEnemyVisible’ in order to run the MoveTo task. I suppose this could also be in the “Update My Black Board Key” function.

Another issue could be setting the enemy after running the behavior tree. I’ve run into issue where setting certain values after starting the tree will cause it not to work, especially if the enemy can see you right when the game starts.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 9:08pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/3 "2015-10-24T21:08:50Z")

</div>

Have you tried any of AI debugging tools we have, namely Gameplay Debugger (look at AI and press '-key), BT debugger (have BT asset opened then PIE), Visual Log (summon UI by calling `vislog` console command, and press “record”)? Also, simplifying your setup would also help nailing down the cause of the bug (although I have a feeling there’s couple of things going wrong here), like removing the “is visible” condition from your BT.

Cheers,

–mieszko

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 9:37pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/4 "2015-10-24T21:37:27Z")

</div>

I did not know how to access these tools, thanks for showing me these. I just picked up UE4 a few weeks ago for a project so I’m still trying to get the hang of it.  
I got a few interesting results out of looking at these tools. It doesn’t look like my controller is running as the visual log shows the pawn to be none in AI controller. Even the task comes back as none in the gameplay debugger.

 ![63993-visuallog.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/a/e/9aec09e20cb956ee09a0a98dc67149853cb5fe05.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 9:41pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/5 "2015-10-24T21:41:53Z")

</div>

Thanks for the reply.

I actually don’t have a need for “IsEnemyVisible”, so I deleted it. The perception is within the function. I’m not even sure if I really need a perception component as well.

All I’m trying to do is get them to move and follow my character, but even when I tried just a simple move to, they didn’t want to move either.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 9:44pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/6 "2015-10-24T21:44:46Z")

</div>

Pawn is always “None” in the first frame of AIController’s log, that’s normal 🙂

If you sent me a saved vislog file I could have a look and see what it says about failing to move.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 9:48pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/7 "2015-10-24T21:48:42Z")

</div>

Also, a quick glance at the gameplay debugger shot tells me spiders don’t see the player. I suggest going to spider perception’s sight config and flicking on seeing all “affiliations”, meaning not only enemies but friendlies and neutral as well. It’s a known bug in perception system that it doesn’t handle that properly currently.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 9:51pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/8 "2015-10-24T21:51:05Z")

</div>

Oh, and having a fallback behavior in your tree, that will get hit when nothing else is valid, like a “Wait” task at the end of the tree, is always a good idea, especially for debugging purposes. Currently by looking at gameplay debugger shot it’s hard to tell whether the BT has been stopped or just haven’t found any valid tasks.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 9:54pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/9 "2015-10-24T21:54:53Z")

</div>

Ah I see. I’ve put the vislog file in my google drive since I can’t attach it here, the link for it is below. I appreciate you taking a look at it for me.

[https://drive.google.com/file/d/0B3Hk6cMY-osbZmp6N0c2aE04bDg/view?usp=sharing](https://drive.google.com/file/d/0B3Hk6cMY-osbZmp6N0c2aE04bDg/view?usp=sharing)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 10:24pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/10 "2015-10-24T22:24:40Z")

</div>

That’s what I thought the problem was originally, and I checked to make sure that I was using the right nodes so that they can see the player, but it looked fine based off of the tutorials. I followed both of your suggestions and they still remain idle.

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 10:25pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/11 "2015-10-24T22:25:43Z")

</div>

I’ve looked at the log and all it says is that it doesn’t run the move task because it’s restricted by the blackboard-based condition. I suggest getting rid of it, at least for debugging purposes. Also, note that “Player” key in blackboard is not set, and you need to make sure it is before trying to sent AI to “player’s location”.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b027b6f9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b027b6f9](https://forums.unrealengine.com/u/anonymous_user_b027b6f9)\
**Post date:** [October 24, 2015, 10:33pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/12 "2015-10-24T22:33:29Z")

</div>

I’m not sure if it’s correct, but this is how I have my blackboard set up for “Player”.

 ![63994-blackboard.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/0/b/50b2a89ca797951b9586457f885aa2279a23ca7b.png)

---

<div class="post-metadata">

**Author:** ![MieszkoZ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MieszkoZ](https://forums.unrealengine.com/u/MieszkoZ)\
**Post date:** [October 24, 2015, 10:35pm UTC](https://forums.unrealengine.com/t/why-does-my-ai-not-move/336372/13 "2015-10-24T22:35:42Z")

</div>

Yeah, but that’s just blackboard setup. You need to feed it with data. For example implement a simple BT service in BP that would just get first player (there’s a BP function for it) and set the Player key in BB.
