Exemplo n.º 1
0
 public static bool RemoveOverlap(this IRageSpline path, int index0, int index1, float snapRadius, bool debug)
 {
     if (index1 == 0)
     {
         index0 = path.GetPointCount() - 1;
     }
     if (Vector3.Distance(path.GetPositionWorldSpace(index0), path.GetPositionWorldSpace(index1)) <= snapRadius)
     {
         if (debug)
         {
             Debug.Log("overlap path pos = " + path.GetPositionWorldSpace(index0));
         }
         path.SetNatural(index1, false);
         path.SetInControlPositionWorldSpace(index1, path.GetInControlPositionWorldSpace(index0));
         path.RemovePoint(index0);      // Then deletes the duplicate previous point
         return(true);
     }
     return(false);
 }