Click to move animation not working(Solved)

Hi all any help would be great!

I have an animated character and I’m just trying to get him to walk when i click the right mouse button at a target location and then stop.

This is possible to do but its not instant and i have tried to change the transition time but with no effect so i tried to force it with booleans and script it but this doesn’t seem to work ether.

Plus it doesn’t stop the character from working making it go back to idle.

In animator i have a boolean called IsWalking true and false.
Bool true → Idle to IsWalking
Bool false → IsWalking to Idle

think thats everything if I’m missing any info let me know what you want to know and i will host it asap.
Ideas examples and references welcome…

Thanks

public NavMeshAgent agent;
    private Animator anim;
    public bool walking;

    void Start(){
        agent = GetComponentInChildren<NavMeshAgent> ();
        anim = GetComponentInChildren<Animator> ();
    }

    void FixedUpdate(){
       
        if (Input.GetButtonDown ("Fire2")) {
            RaycastHit hit;

            if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 100)) {
                agent.destination = hit.point;

            }
        }
        Animations ();

    }
       
    void Animations(){
        bool walking = Input.GetAxis ("Vertical");
        anim.SetBool ("IsWalking", walking);
    }
bool walking = Input.GetAxis ("Vertical");

This code should be ignored as this was a test which has been removed.

The delay is most likely due to the fact that you are handling input and rendering updates in FixedUpdate(). Change it to Update() and it should work fine then.

As a general rule of thumb, input and output should always happen every frame. Game logic, physics, and simulations should happen at fixed time intervals.

Thanks for the info buddy! I reread the documentation for update and found that i had read it the wrong way round…would have been here for years not thinking about that!
Also your little nudge helped me reread another bit of animation docs and i have sorted another problem.

:slight_smile: