generateCuboid() public method

Creates an axis-aligned cube mesh at the given center point, with the given size dimensions, from the input UV coordinates.
public generateCuboid ( Vector3 size, Vector3 center, Vector2 uvStart, Vector2 uvEnd ) : void
size Vector3
center Vector3
uvStart Vector2
uvEnd Vector2
return void
Example #1
0
 private void enableRendering()
 {
     if (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight)
     {
         Transform    modelBase = part.transform.FindRecursive("model");
         DragCube     cube;
         GameObject   go;
         int          len = part.DragCubes.Cubes.Count;
         Vector3      size;
         Vector3      center;
         Mesh         mesh;
         MeshFilter   filter;
         MeshRenderer render;
         for (int i = 0; i < len; i++)
         {
             cube = part.DragCubes.Cubes[i];
             go   = new GameObject("DragCubeRenderer");
             MeshBuilder mb = new MeshBuilder();
             size   = cube.Size;
             center = cube.Center;
             mb.generateCuboid(size, center, Vector2.zero, Vector2.one);
             mesh           = mb.buildMesh();
             filter         = go.AddComponent <MeshFilter>();
             filter.mesh    = mesh;
             render         = go.AddComponent <MeshRenderer>();
             render.enabled = true;
             go.transform.NestToParent(modelBase);
         }
     }
 }
 private void enableRendering()
 {
     if (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight)
     {
         Transform modelBase = part.transform.FindRecursive("model");
         DragCube cube;
         GameObject go;
         int len = part.DragCubes.Cubes.Count;
         Vector3 size;
         Vector3 center;
         Mesh mesh;
         MeshFilter filter;
         MeshRenderer render;
         for (int i = 0; i < len; i++)
         {
             cube = part.DragCubes.Cubes[i];
             go = new GameObject("DragCubeRenderer");
             MeshBuilder mb = new MeshBuilder();
             size = cube.Size;
             center = cube.Center;
             mb.generateCuboid(size, center, Vector2.zero, Vector2.one);
             mesh = mb.buildMesh();
             filter = go.AddComponent<MeshFilter>();
             filter.mesh = mesh;
             render = go.AddComponent<MeshRenderer>();
             render.enabled = true;
             go.transform.NestToParent(modelBase);
         }
     }
 }