- Home /
Basic 2d AI follow?
Hey, I'm pretty new to this unity 2d and I just want to ask about some help regarding how to code an ai. as seen on the picture; I want it to follow me. So is there any ways to do a follow script? Please tell me.
You are not getting a response because your question is to general. In essence, you are asking how to program in Unity. The best way to get started is to start absorbing the many great tutorials here: http://unity3d.com/learn/tutorials/modules
Answer by jpthek9 · Feb 26, 2015 at 07:44 AM
//Moving towards player Vector3 Destination = Player.transform.position; transform.position += (Destination - transform.position).normalized * Speed;
That's the general gist of how you move towards the player. If you're looking for some fancy curving and/or path prediction, look for steering behaviors.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184335im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A* pathfinding for 2D top Down 0 Answers
Check lenght from player? 2 Answers
Simple AI In 2D - C# 1 Answer
Multiple Cars not working 1 Answer
Problem with mobs 0 Answers