Can someone help me im new to programming and dont understand why the animation dont stop running when it reaches the destination
I'm using the raycast system to poin a direction with my mouse but when the character reaches the destination he just keeps running and it tells me that is walking has not been set to false?
I have tried looking it up on tutorials and checked the animator and all but cant figure it out?
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI;
public class PlayerMovement : MonoBehaviour {
 public NavMeshAgent playerNavMeshAgent;
 public Camera playerCamera;
 public Animator playerAnimator;
 public bool isWalking;
 // Start is called before the first frame update
 void Start()
 {
    
 }
 // Update is called once per frame
 void Update()
 {
    if (Input.GetMouseButton(0))
     {
         Ray myRay = playerCamera.ScreenPointToRay(Input.mousePosition);
         RaycastHit myRaycastHit;
         if (Physics.Raycast(myRay, out myRaycastHit))
         {
             playerNavMeshAgent.SetDestination(myRaycastHit.point);
         }
     }
     if (playerNavMeshAgent.remainingDistance <= playerNavMeshAgent.stoppingDistance)
     {
         isWalking = false;
     }
     else
     {
         isWalking = true;
     }
     playerAnimator.SetBool("isWalking", isWalking);
 }
}
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                