Example #1
0
    private void OnSceneGUI()
    {
        curve = target as BezierCurve;
        handleTransform = curve.transform;
        handleRotation = Tools.pivotRotation == PivotRotation.Local ?
            handleTransform.rotation : Quaternion.identity;

        Vector3 p0 = ShowPoint(0);
        Vector3 p1 = ShowPoint(1);
        Vector3 p2 = ShowPoint(2);

        Handles.color = Color.gray;
        Handles.DrawLine(p0, p1);
        Handles.DrawLine(p1, p2);

        Handles.color = Color.white;

        Vector3 lineStart = curve.GetPoint(0f);
        Handles.color = Color.green;
        Handles.DrawLine(lineStart, lineStart + curve.GetVelocity(0f));
        for(int i = 0; i <= LINESTEPS; i++)
        {
            Vector3 lineEnd = curve.GetPoint(i / (float)LINESTEPS);
            Handles.color = Color.white;
            Handles.DrawLine(lineStart, lineEnd);
            Handles.color = Color.green;
            Handles.DrawLine(lineEnd, lineEnd + curve.GetVelocity(i / (float) LINESTEPS));
            lineStart = lineEnd;
        }
    }
Example #2
0
    private void OnSceneGUI()
    {
        curve           = target as BezierCurve;
        handleTransform = curve.transform;
        handleRotation  = Tools.pivotRotation == PivotRotation.Local ?
                          handleTransform.rotation : Quaternion.identity;

        Vector3 p0 = ShowPoint(0);
        Vector3 p1 = ShowPoint(1);
        Vector3 p2 = ShowPoint(2);

        Handles.color = Color.gray;
        Handles.DrawLine(p0, p1);
        Handles.DrawLine(p1, p2);

        Handles.color = Color.white;

        Vector3 lineStart = curve.GetPoint(0f);

        Handles.color = Color.green;
        Handles.DrawLine(lineStart, lineStart + curve.GetVelocity(0f));
        for (int i = 0; i <= LINESTEPS; i++)
        {
            Vector3 lineEnd = curve.GetPoint(i / (float)LINESTEPS);
            Handles.color = Color.white;
            Handles.DrawLine(lineStart, lineEnd);
            Handles.color = Color.green;
            Handles.DrawLine(lineEnd, lineEnd + curve.GetVelocity(i / (float)LINESTEPS));
            lineStart = lineEnd;
        }
    }
Example #3
0
    private void ShowTangents()
    {
        Handles.color = Color.green;
        var point = curve.GetPoint(0f);

        Handles.DrawLine(point, point + curve.GetVelocity(0f).normalized);
        for (var i = 1; i <= lineSteps; i++)
        {
            point = curve.GetPoint(i / (float)lineSteps);
            Handles.DrawLine(point, point + curve.GetVelocity(i / (float)lineSteps).normalized);
        }
    }
    private void OnSceneGUI()
    {
        curve = target as BezierCurve;

        handleTransform = curve.transform;
        handleRotation = Tools.pivotRotation == PivotRotation.Local ? handleTransform.rotation : Quaternion.identity;

        Vector3 p0 = ShowPoint(0);
        Vector3 p1 = ShowPoint(1);
        Vector3 p2 = ShowPoint(2);

        Handles.color = Color.gray;

        // Draws straight lines between p0->p1 and from p1->p2
        Handles.DrawLine(p0, p1);
        Handles.DrawLine(p1, p2);

        Handles.color = Color.white;
        Vector3 lineStart = curve.GetPoint(0f);

        Handles.color = Color.green;
        Handles.DrawLine(lineStart, lineStart + curve.GetVelocity(0f));

        for (int i = 1; i <= lineSteps; i++)
        {
            Handles.color = Color.white;
            Vector3 lineEnd = curve.GetPoint(i / (float)lineSteps);
            Handles.DrawLine(lineStart, lineEnd);
            lineStart = lineEnd;
        }
    }