# How to make a flying AI that follows the player?

**URL:** <https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805>\
**Category:** Community & Industry Discussion\
**Tags:** flying, how-can-i-fix-this, unreal-engine, question\
**Created:** [December 19, 2018, 4:25pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805 "2018-12-19T16:25:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![E4ce\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@E4ce\_1](https://forums.unrealengine.com/u/E4ce_1)\
**Post date:** [December 19, 2018, 4:25pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/1 "2018-12-19T16:25:33Z")

</div>

As the title says, how I make an AI (like a sphere) that follows the player in the 3d sidescroller template? I’m rather new to Unreal Engine and using blueprints but I’ve done some things by looking at other posts and questions that other people have had before. As for now, The “AI” is not moving at all or doing anything interesting. Here are some pictures of what I’ve done so far:

 ![262855-screenshot1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/f/f3fa55193e8a9ca00867120cbc9d8a6567f7e75f.png)

 ![262856-screenshot2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/8/6/686963123dbed5443f91c6220e23baaf4b21ec70.png)

The first picture is the actor and the second is the controller class. I know I’ve done something wrong, would appreciate any help.

---

<div class="post-metadata">

**Author:** ![Lupix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lupix/32/593417_2.png) [@Lupix](https://forums.unrealengine.com/u/Lupix)\
**Post date:** [December 19, 2018, 4:35pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/2 "2018-12-19T16:35:11Z")

</div>

Have you looked into Unreal Engine’s AI features? There are behaviour trees with which you’ll have an easier time implementing AI. May I suggest you have a look at this: [https://docs.unrealengine.com/en-US/Engine/AI/BehaviorTrees/QuickStart](https://docs.unrealengine.com/en-US/Engine/AI/BehaviorTrees/QuickStart)

---

<div class="post-metadata">

**Author:** ![E4ce\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@E4ce\_1](https://forums.unrealengine.com/u/E4ce_1)\
**Post date:** [December 19, 2018, 5:12pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/3 "2018-12-19T17:12:59Z")

</div>

Wow, making an “AI” in UE4 was much more in depth than I thought. This might help.

---

<div class="post-metadata">

**Author:** ![DavidOConnor](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/davidoconnor/32/978533_2.png) [@DavidOConnor](https://forums.unrealengine.com/u/DavidOConnor)\
**Post date:** [December 19, 2018, 11:45pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/4 "2018-12-19T23:45:09Z")

</div>

if you are just aiming to have a very simple AI that follows the player… the following solution doesn’t need AI

I’d just use a spring arm setup… but put your AI character on the end of it. You can put the AI in your Player Character BP, use a separate AI Rig (with AI mesh component and spring arm component) that is a child of your Player Character, or just on Tick constantly set the AI Rig location at your Player Character.

The length and relative rotation of your Spring Arm component, along with Socket/Target Offset will give you the offsets that you need.

VERY simple to set up, VERY performance efficient and the spring arm position lag & rotation lag will provide really nice smoothing

---

<div class="post-metadata">

**Author:** ![Nebula\_Games\_Inc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nebula\_Games\_Inc](https://forums.unrealengine.com/u/Nebula_Games_Inc)\
**Post date:** [December 20, 2018, 6:32am UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/5 "2018-12-20T06:32:47Z")

</div>

Agree with the above…unless your “sphere” is actually going to do something “intelligent” it doesn’t need to be “artificially intelligent” (AI). Following the player can be easily done with a spring arm or parenting etc.

---

<div class="post-metadata">

**Author:** ![E4ce\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@E4ce\_1](https://forums.unrealengine.com/u/E4ce_1)\
**Post date:** [December 21, 2018, 2:34pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/6 "2018-12-21T14:34:46Z")

</div>

Sorry I wasn’t clear enough in my question. What I want is a “sphere” or something similar that can be placed anywhere in the 3d sidescroller world and when the player comes close enough the sphere will engage and move to the player.

---

<div class="post-metadata">

**Author:** ![E4ce\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@E4ce\_1](https://forums.unrealengine.com/u/E4ce_1)\
**Post date:** [December 21, 2018, 2:35pm UTC](https://forums.unrealengine.com/t/how-to-make-a-flying-ai-that-follows-the-player/439805/7 "2018-12-21T14:35:25Z")

</div>

I wasn’t clear enough in my question. What I want is a “sphere” or something similar that can be placed anywhere in the 3d sidescroller world and when the player comes close enough the sphere will engage and move to the player.
