Checking if mouse dragged from one point to another

Im tryingto check if the mouse was left clicked and passed over, lets say, position 2,0,0 to position -3,0,0, and then does an action. Like the mouse dragging over a specified path and that triggers an even. Any help is much appreciated…been at this all night lol.

You could register the mouse position when the button is pressed and measure the distance when the mouse button is released, like this:

var startPos: Vector3;

function Update(){
  if (Input.MouseButtonDown(0)){
    startPos = Input.mousePosition;
  }
  if (Input.MouseButtonUp(0)){
    var offset = Input.mousePosition - startPos;
    if (offset.magnitude > 5){
      print("Mouse moved more than 5 pixels");
    }
  }
}

But notice that this code is operating in screen space: the distance is measured in pixels, not in the 3D world units. If you want to analyse the movement in the 3D world, things become way more complicated: you should use raycasts to find the 3D position in the mouse down and the mouse up cases, and the results could be very hard to handle - only objects that have a collider are detected by a raycast, thus you could have a mouse down point without a mouse up position, or vice versa, or no point at all (if you clicked the sky, for instance).

I think this could answer to your question, if i understand you right…

javascript :

var pressed : boolean = false;

function OnMouseOver(){
    if(Input.GetButtonDown("Fire1"))
        pressed = !pressed ;
}

C# :

bool pressed = false;

//this script just sets pressed true if the mouse is over the object, 
// this script is attached too the rest is up to you...

void OnMouseOver(){
    if(Input.GetButtonDown("Fire1"))
        pressed = !pressed ;
}