示例#1
0
    void OnDrawGizmos()
    {
        List <Vector3> points = new List <Vector3>(parentTransform.childCount);

        foreach (Transform child in parentTransform)
        {
            if (child.gameObject.activeInHierarchy)
            {
                points.Add(child.position);
            }
        }

        if (fitType == FitType.Line)
        {
            Fit.Line(points, out origin, ref direction, 1, true);
        }
        else if (fitType == FitType.LineFast)
        {
            Fit.LineFast(points, out origin, ref direction, 1, true);
        }
        else if (fitType == FitType.Plane)
        {
            Fit.Plane(points, out origin, out direction, 100, true);
        }
        else if (fitType == FitType.OrdinaryLine)
        {
            Fit.Polynomial(points, 1, true);
        }
        else if (fitType == FitType.OrdinaryParabola)
        {
            Fit.Polynomial(points, 2, true);
        }
        else if (fitType == FitType.OrdinaryCubic)
        {
            Fit.Polynomial(points, 3, true);
        }
    }