Example #1
0
 public override void CreateSpline(params Vector7[] positions)
 {
     if (Waypoints.Length != positions.Length)
     {
         Waypoints = new Waypoint[positions.Length];
         for (int i = 0; i < Waypoints.Length; i++)
         {
             Waypoints[i] = Waypoint.FromVector7(positions[i]);
         }
         InvalidateDistanceCache();
     }
     else
     {
         bool hasChanged = false;
         for (int i = 0; i < Waypoints.Length; i++)
         {
             if (Waypoint.AreEqual(positions[i], Waypoints[i]))
             {
                 continue;
             }
             Waypoints[i].Position = new Vector3(positions[i].a, positions[i].b, positions[i].c);
             Waypoints[i].Tangent  = new Vector3(positions[i].d, positions[i].e, positions[i].f);
             Waypoints[i].Roll     = positions[i].g;
             hasChanged            = true;
         }
         if (hasChanged)
         {
             InvalidateDistanceCache();
         }
     }
 }
Example #2
0
        public override bool AreSplinesSimilare(SplineBase splineA, SplineBase splineB)
        {
            Spline A = splineA as Spline;
            Spline B = splineB as Spline;

            if (A == null || B == null)
            {
                return(false);
            }
            for (int i = 0; i < A.Waypoints.Length; i++)
            {
                if (!Waypoint.AreEqual(A.Waypoints[i], B.Waypoints[i]))
                {
                    Debug.Log("not equal waypoints " + i);
                    return(false);
                }
            }
            return(true);
        }
Example #3
0
        public override bool AreSplinesSimilare(SplineBase splineA, SplineBase splineB)
        {
            SplineSmooth A = splineA as SplineSmooth;
            SplineSmooth B = splineB as SplineSmooth;

            if (A == null || B == null)
            {
                return(false);
            }

            for (int i = 0; i < A.Waypoints.Length; i++)
            {
                if (!Waypoint.AreEqual(A.Waypoints[i], B.Waypoints[i]))
                {
                    return(false);
                }
            }
            return(true);
        }