Find mouse distance from last location?

Trying to detect the mouse distance between two mouse locations.
This below is giving me radical numbers. Some times its 18 other times 130 and i hardly move the mouse.
I must not be doing it correctly?

if(Vector2.Distance(LastMousePostion, Input.mousePosition) > .1){

Hi @Shadowing ,

How are you calculating/setting the last mouse position? Maybe you do it in wrong place or at a wrong time.

You probably should set it every update and then compare it in the next update to the current mouse position.

Thanks for the response @Olmi
Like this below.

I hover my mouse over a area. it trips runs the Co-routine for 1 sec and if the mouse has moved to far then don’t show the pop up window.

        if(!Input.GetKey(KeyCode.Mouse0) && !Input.GetKey(KeyCode.Mouse1)){
            LastMousePostion = Input.mousePosition;
            QuestDetailsCoroutine = StartCoroutine(ShowQuestDetails(questInformation, quest));
        }
    IEnumerator ShowQuestDetails(JSONNode questInformation,Quest quest){
        yield return new WaitForSeconds(1.0f);

        if(Vector2.Distance(LastMousePostion, Input.mousePosition) > .1){
            LastMousePostion = Vector2.zero;
        } else {
            LastMousePostion = Vector2.zero;
            DisplayQuestDetails(questInformation, quest,true);
        }
      
    }