/// <summary> /// Centers Control Points around Spline transform /// </summary> /// <param name="spline">The spline to address</param> public static void centerPivot(CurvySpline spline) { Bounds b = spline.GetBounds(false); Vector3 off = spline.Transform.position - b.center; foreach (CurvySplineSegment cp in spline.ControlPoints) { cp.Transform.position += off; } spline.transform.position -= off; spline.Refresh(); }
/// <summary> /// Centers Control Points around Spline transform /// </summary> /// <param name="spline">The spline to address</param> public static void centerPivot(CurvySpline spline) { Bounds b = spline.GetBounds(false); Vector3 off = spline.Transform.position - b.center; foreach (CurvySplineSegment cp in spline.ControlPoints) cp.Transform.position += off; spline.transform.position -= off; spline.Refresh(); }