Hi guys,
I create a AI follow script, bots start separed but they begin to begin to join and they create a queue.
Sugestions for they stop join?
CODE:
var lookPos = target.transform.position - transform.position;
lookPos.y = 0;
var rotation = Quaternion.LookRotation(lookPos);
transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime*10);
moveDirection = Vector3(0, 0, 1);
moveDirection = transform.TransformDirection(moveDirection);
var nspeed = Random.Range(0.5 , 4.0);
moveDirection *= nspeed/10;
print(nspeed/10);
grav+=applyGravity*Time.deltaTime*applyGravity;
moveDirection.y -= grav;
controller.Move(moveDirection * Time.deltaTime *2);
animation.Play("run");
there is the video of the my AI FOLLOW