title: Determine if a point is between 2 other points on a line
body: <p>I have been trying to work out how to check if a point is on the same line and inbetween two other points. It seems to work if the line is diagonal but if its straight vertically or horizontally it fails.</p>
  
  <p>This is my method:</p>
  
  <pre><code>public bool isBetween(Vector3 C, Vector3 A, Vector3 B)
  {
      Vector3 sum = Vector3.Cross(A,B) + Vector3.Cross(A,C) + Vector3.Cross(B,C);
  
      if (sum.x == 0 &amp;&amp; sum.z == 0 &amp;&amp; sum.y == 0)
      {
          Vector3 min = Vector3.Min(A, B);
          Vector3 max = Vector3.Max(A, B);
  
          // only checking 2 dimensions
          if (C.x &gt; min.x &amp;&amp; C.x &lt; max.x &amp;&amp; C.z &gt; min.z &amp;&amp; C.z &lt; max.z)
          {
              return true;
          }
      }
      return false;
  }
  </code></pre>
  
  <p>It works for certain cases but not 100% for all cases. Not sure how to fix it to get it working.</p>