示例#1
0
    static void create3DGround()
    {
        GameObject     ground = new GameObject("3DCurvedGround");
        CurvedGround3D curve  = ground.AddComponent <CurvedGround3D>();

        ground.AddComponent <MeshFilter>();
        ground.AddComponent <MeshRenderer>();
        ground.AddComponent <MeshCollider>();

        curve.addPointAtPosition(new Vector3(1, 30, 0));
        curve.addPointAtPosition(new Vector3(10, 40, 0));
        curve.addPointAtPosition(new Vector3(20, 30, 0));


        setDefaulMaterial(ground);

        curve.renderCurveMesh();

        Undo.RegisterCreatedObjectUndo(ground, "created 3DCurvedGround");
    }