コード例 #1
0
    private void Draw()
    {
        CubicBezier worldBezier = cubicBezierPath.WorldSpaceBezier;

        // draw bezier
        Vector3[] cPointCache = new EvaluationCache(worldBezier, CubicBezier.GoodNumMidPoints).Values;

        /*Handles.color = Color.yellow;
         * Handles.DrawAAPolyLine(cPointCache);
         */
        for (int i = 0; i < cPointCache.Length - 1; i++)
        {
            Handles.color = Color.Lerp(Color.yellow, Color.magenta, (float)i / cPointCache.Length);
            var lineSegment = new Vector3[2];
            lineSegment[0] = cPointCache[i];
            lineSegment[1] = cPointCache[i + 1];
            Handles.DrawAAPolyLine(lineSegment);
        }

        // draw direction cone cap
        if (!settings.HideDirectionCones && targetScript.transform.lossyScale != Vector3.zero) //check for zero vector, since LookRotation logs messages
        {
            float startConeSize = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(0f));
            float endConeSize   = PathEditorUtility.Nice3DHandleSize(worldBezier.Evaluate(1f));

            Handles.color = Color.yellow;
            Handles.ConeCap(0, worldBezier.Evaluate(0f), Quaternion.LookRotation(worldBezier.Tangent(0f)), startConeSize);
            Handles.color = Color.magenta;
            Handles.ConeCap(0, worldBezier.Evaluate(1f), Quaternion.LookRotation(worldBezier.Tangent(1f)), endConeSize);
        }

        // draw tangent lines
        if (!settings.HideTangentLines)
        {
            Handles.color = Color.cyan;
            Handles.DrawDottedLine(worldBezier.StartPosition, worldBezier.StartTangent, 7.5f);
            Handles.DrawDottedLine(worldBezier.EndPosition, worldBezier.EndTangent, 7.5f);
        }

        // test t
        if (settings.TestInterpolate)
        {
            PathEditorUtility.DrawTestInterpolate(worldBezier, settings.EditorData.T);
        }

        // draw GUI
        InterpolateSceneGUI();
        ToolShelf();
    }
コード例 #2
0
ファイル: PathMaker.cs プロジェクト: MoonJiao123/Drifters
        void MakeMesh()
        {
            ControlPoint cpA = new ControlPoint(transformA.position, transformA.forward * transformA.localScale.z);
            ControlPoint cpB = new ControlPoint(transformB.position, transformB.forward * transformB.localScale.z);

            Curve          curve  = CubicBezier.Evaluate(cpA, cpB, pointCount);
            ExtruderResult result = Extruder.Extrude(curve, crossSection, LineTextureMode.Tile);

            Mesh mesh = result.GenerateMesh();

            mesh.RecalculateNormals();
            mesh.RecalculateTangents();
            mesh.RecalculateBounds();
            meshFilter.sharedMesh = mesh;
        }
コード例 #3
0
 public override float Convert(float x)
 {
     return(curve.Evaluate(x));
 }