public FairingBase buildFairing() { MeshGenerator gen = new MeshGenerator(); GameObject root = new GameObject(); GameObject[] panels = generateFairingPanels(gen, root); FairingBase fairing = new FairingBase(root, panels); return fairing; }
//destroy any procedurally created panel sections private void destroyPanels() { if(fairingBase==null){return;} fairingBase.root.transform.parent = null; GameObject.Destroy(fairingBase.root); fairingBase = null; }
//create procedural panel sections for the current part configuration (radialSection count), with orientation set from base panel orientation private void createPanels() { float totalHeight = baseHeight + currentHeight; float startHeight = - (totalHeight / 2); float tRad, bRad, height; tRad = topRadius; bRad = bottomRadius; height = currentHeight; InterstageFairingGenerator fg = new InterstageFairingGenerator(startHeight, baseHeight, boltPanelHeight, height, maxPanelSectionHeight, bRad, tRad, wallThickness, numOfRadialSections, cylinderSides); fairingBase = fg.buildFairing (); Transform modelTransform = part.partTransform.FindChild("model"); fairingBase.root.transform.NestToParent(modelTransform); fairingBase.root.transform.rotation = modelTransform.rotation; fairingBase.setMaterial(fairingMaterial); if(HighLogic.LoadedSceneIsEditor){setPanelOpacity(0.25f);} else{setPanelOpacity(1.0f);} }