# Make an AI follow an object

**URL:** <https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196>\
**Category:** AI\
**Tags:** unreal-engine, question\
**Created:** [December 20, 2020, 11:10pm UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196 "2020-12-20T23:10:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![1984-Boo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1984-Boo](https://forums.unrealengine.com/u/1984-Boo)\
**Post date:** [December 20, 2020, 11:10pm UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/1 "2020-12-20T23:10:38Z")

</div>

Hello, I’ve found this tutorial for create an AI Controller who’s following the Player.

But how make an AI following an object ?

---

<div class="post-metadata">

**Author:** ![Marcis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/marcis/32/1103070_2.png) [@Marcis](https://forums.unrealengine.com/u/Marcis)\
**Post date:** [December 21, 2020, 9:46am UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/2 "2020-12-21T09:46:59Z")

</div>

Instead of setting the player character as the object you can set any other actor. You can retrieve the reference in many ways. One of which is to use a perception component with sight and/or hearing sense configured.

---

<div class="post-metadata">

**Author:** ![1984-Boo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1984-Boo](https://forums.unrealengine.com/u/1984-Boo)\
**Post date:** [December 21, 2020, 11:27am UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/3 "2020-12-21T11:27:57Z")

</div>

I tried like this, but i don’t know what to put in object input of my cast.

 ![325311-17.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/7/5f72c8963f2f78f846a17d57509fb61e211f7548.png)

---

<div class="post-metadata">

**Author:** ![Marcis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/marcis/32/1103070_2.png) [@Marcis](https://forums.unrealengine.com/u/Marcis)\
**Post date:** [December 21, 2020, 11:42am UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/4 "2020-12-21T11:42:07Z")

</div>

You can use GetActorOfClass node on Begin Play to get a reference to first instance in the world. I don’t think you even need to cast at that point. Just set it as the object.

---

<div class="post-metadata">

**Author:** ![1984-Boo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1984-Boo](https://forums.unrealengine.com/u/1984-Boo)\
**Post date:** [December 21, 2020, 5:05pm UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/5 "2020-12-21T17:05:03Z")

</div>

![325356-18.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/c/0/ec03f0e07e354dcecec07c377439debf16ad5053.png)

I tried this so, but it’s not working, the character don’t follow the giftbox actor

---

<div class="post-metadata">

**Author:** ![Marcis](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/marcis/32/1103070_2.png) [@Marcis](https://forums.unrealengine.com/u/Marcis)\
**Post date:** [December 21, 2020, 5:09pm UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/6 "2020-12-21T17:09:02Z")

</div>

Did you also change the class to the gift box like in the tutorial?

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/a/7/fa7e16190a5b4ad2f13ed9549e6366987736f78f.jpeg "Unreal Engine AI Controller Follow Player") ](https://www.youtube.com/watch?v=Z3mWSpKb3Kw)

---

<div class="post-metadata">

**Author:** ![1984-Boo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1984-Boo](https://forums.unrealengine.com/u/1984-Boo)\
**Post date:** [December 21, 2020, 6:24pm UTC](https://forums.unrealengine.com/t/make-an-ai-follow-an-object/476196/7 "2020-12-21T18:24:59Z")

</div>

yeah I did.  
But not working with this. So I used a note AI Move To in the BP of the character
