I’m making a small game for myself and I’m struggling to find a solution to a problem:

The code used for swiping and move the player is this but is really inaccurate. Since I’m making a 3D isometric game with movement based on screen swipe (Mobile) this works but sometimes I get the wrong input

```
if (Input.GetMouseButtonDown(0))
{
startPos = ClickedPoint();
}
if (Input.GetMouseButtonUp(0))
{
endPos = ClickedPoint();
Vector3 distance = endPos - startPos;
if (distance.z > 0 && Mathf.Abs(distance.z) > Mathf.Abs(distance.x))
{
Debug.Log("Top");
pos = Vector3.forward;
MovePlayers();
return;
}
else if (distance.z < 0 && Mathf.Abs(distance.z) > Mathf.Abs(distance.x))
{
Debug.Log("Bot");
pos = Vector3.back;
MovePlayers();
return;
}
else if (distance.x < 0 && Mathf.Abs(distance.z) < Mathf.Abs(distance.x))
{
Debug.Log("Left");
pos = Vector3.left;
MovePlayers();
return;
}
else if (distance.x > 0 && Mathf.Abs(distance.z) < Mathf.Abs(distance.x))
{
Debug.Log("Right");
pos = Vector3.right;
MovePlayers();
return;
}
}
```

This is what I would like to achieve (It can be made on the whole screen, I made every movement in a side of the base to make it easier to see)