So, I know people don’t like give-me threads, but I’ve tried everything, Does anyone have a simple AI script that makes the “enemy” follow the player!
quite literally the example in that will move towards a target gameobject
1 Like
Try Transform.LookAt and transform.Translate(Vector3.forward * Time.deltaTime). This is extremely simple though. If you want it to use the navmesh you use NavMeshAgent.SetDestination(player.position) and just constantly update SetDestination to the player’s current position.
Simplest way to do this is make the enemy look at the player and move towards it at a certain speed :
public Transform target; //the player
public float moveSpeed = 2.0f;
void Update(){
//Look at the target
transform.LookAt(target);
//Move towards the target
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
Check out the Learn Section. The Stealth project has some good AI that you can learn from.
So, How do i make the script see the target as the player?
WAit, NVM i figured it out, Thanks a lot m8