Enemy animation gets weird when going to set position
I have an enemy AI and works great until the player is gone and the enemy wants to search at the last known location of the player. Please take a minuet to watch the video to really know what the problem is: https://www.youtube.com/watch?v=k7IYzN5Rq0M&feature=youtu.be
I know the part at the end where the enemy slides to the point but i don't know how to fix that and make the enemy stop from keeping moving... CODE:
  IEnumerator searchForPlayer(){
             if (didEnemySeePlayer) {
                 yield return new WaitForSeconds(5);
                 lastPlaceDirection = lastPlayerPosition - transform.position;
                 lastPlaceDirection.y = 0;
                 lastPlaceAngle = Vector3.Angle (lastPlaceDirection, transform.forward);
                 transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.LookRotation (lastPlaceDirection), 0.1f);
                 print ("checks if starting walking");
                 chaseState = "WALK";
                 print ("Changed state");
                 movingProcess ();
                 print ("started walking");
                 if(Vector3.SqrMagnitude(transform.position - lastPlayerPosition) < 230){
                     didEnemySeePlayer = false;
                     print ("Changed to false");
                     enemyIsIdle ();
                 }
             }
         }
 
               Please write to me if you have any question but please do try and answer mine. TX.
               Comment
              
 
               
              Your answer