Hi,

I’m trying to find the closest point to where the mouse is clicked (topArrow, bottomArrow etc are Vector3 points on screen).

The problem is no matter where I click, it either says rightArrow or topArrow are closest; this is because they are both in the positive direction.

How can I fix this to return the actual closest?

```
Vector3 topArrow = new Vector3(0,12,0);
Vector3 bottomArrow = new Vector3(0,-12,0);
Vector3 leftArrow = new Vector3(-30,0,0);
Vector3 rightArrow = new Vector3(30,0,0);
Vector3 getNearestArrow()
{
Vector3 closestPos = new Vector3(0,0,0);
float closestDistance = Mathf.Infinity;
if(Vector3.Distance (topArrow,Input.mousePosition) < closestDistance)
{
closestDistance = Vector3.Distance (topArrow,Input.mousePosition);
closestPos = topArrow;
}
if(Vector3.Distance (bottomArrow,Input.mousePosition) < closestDistance)
{
closestDistance = Vector3.Distance (bottomArrow,Input.mousePosition);
closestPos = bottomArrow;
}
if(Vector3.Distance (leftArrow,Input.mousePosition) < closestDistance)
{
closestDistance = Vector3.Distance (leftArrow,Input.mousePosition);
closestPos = leftArrow;
}
if(Vector3.Distance (rightArrow,Input.mousePosition) < closestDistance)
{
closestDistance = Vector3.Distance (rightArrow,Input.mousePosition);
closestPos = rightArrow;
}
return closestPos;
}
```