Ejemplo n.º 1
0
    void Start()
    {
        MeshFilter mf = GetComponent <MeshFilter>();

        Mesh mesh = mf.mesh;

        Points = new Vector3[]
        {
            Transform1.position,
            Transform2.position,
            Transform3.position,
            Transform4.position,
        };

        if (_noPointsYet)
        {
            Normals = new Vector2[]
            {
                new Vector2(0, 0),
                new Vector2(1, 0),
                new Vector2(2, 0),
                new Vector2(3, 0),
            };

            Shape = new Vector2[]
            {
                new Vector2(0, 0),
                new Vector2(0, 1),
                new Vector2(0, 2),
                new Vector2(0, 3),
            };

            _noPointsYet = false;
        }

        _curve = new BezierCurves(Points);

        OrientedPoint[] oPoints = _curve.GeneratePath(NumberOfSubdivisions).ToArray();

        float[] uv = new float[]
        {
            0.0f,
            1,
            0,
            1
        };

        ExtrudeShape extrudeShape = new ExtrudeShape(Shape, Normals, uv);

        _curve.Extrude(mesh, extrudeShape, oPoints);
    }