AiPath Animation

I’ve added the Unity-Chan to the AiPath to have its own animation, but I’m having a problem when Unity-chan reached the target, it will not stop and it will just run around and around. See video below

and here’s the my code for the Update method on AiPath Script

public virtual void Update () {
	if (!canMove) { return; }

	Vector3 dir = CalculateVelocity(GetFeetPosition());

	//Rotate towards targetDirection (filled in by CalculateVelocity)
	RotateTowards(targetDirection);
	if (controller != null) {
		float v = 0.5f;
		anim.SetFloat("Speed", v);							
		anim.speed = animSpeed;							
		currentBaseState = anim.GetCurrentAnimatorStateInfo(0);	
		rb.useGravity = true;
		velocity = new Vector3(0, 0, v);
		velocity = transform.TransformDirection(velocity);
		if (v > 0.1) {
			velocity *= forwardSpeed;
		}
		transform.localPosition += velocity * Time.fixedDeltaTime;

	} else if (rigid != null) {
		rb.AddForce(dir);
	} else {
		tr.Translate(dir*Time.deltaTime, Space.World);
	}
}

I already fixed this problem but how can I put a space allowance on them? Thanks!
http://imgur.com/Is6EVhF

Hi

Great that you managed to solve the first problem.

If you want to make them stop some distance away from each other you can set the target point to not the other character’s position, but instead a small distance away from the other character. For example

var targetPoint = otherCharacter.position + (transform.position - otherCharacter.position).normalized * separationDistance;