/// <summary> /// Update the fairing module height and position based on current tank parameters /// </summary> private void updateFairing(bool userInput) { SSTUNodeFairing[] modules = part.GetComponents <SSTUNodeFairing>(); if (modules == null || modules.Length < 2) { return; } SSTUNodeFairing topFairing = modules[topFairingIndex]; if (topFairing != null) { FairingUpdateData data = new FairingUpdateData(); data.setTopY(partTopY); data.setBottomY(topFairingBottomY); data.setBottomRadius(currentTankDiameter * 0.5f); if (userInput) { data.setTopRadius(currentTankDiameter * 0.5f); } topFairing.updateExternal(data); } SSTUNodeFairing bottomFairing = modules[lowerFairingIndex]; if (bottomFairing != null) { FairingUpdateData data = new FairingUpdateData(); data.setTopRadius(currentTankDiameter * 0.5f); data.setTopY(bottomFairingTopY); if (userInput) { data.setBottomRadius(currentTankDiameter * 0.5f); } bottomFairing.updateExternal(data); } }
private void updateFairing(bool userInput) { if (!standAlonePart) { return; } SSTUNodeFairing fairing = part.GetComponent <SSTUNodeFairing>(); if (fairing == null) { return; } fairing.canDisableInEditor = true; FairingUpdateData data = new FairingUpdateData(); data.setTopY(model.fairingTop); //bottom-y set by 'snap to node' functionality in nodefairing data.setTopRadius(currentDiameter * 0.5f); if (userInput) { data.setBottomRadius(currentDiameter * 0.5f); } data.setEnable(true); fairing.updateExternal(data); }
private void updateFairing(bool userInput) { SSTUNodeFairing fairing = part.GetComponent <SSTUNodeFairing>(); if (fairing == null) { return; } fairing.canDisableInEditor = true; FairingUpdateData data = new FairingUpdateData(); data.setTopY(model.model.currentHeight * 0.5f + model.model.getFairingOffset()); data.setTopRadius(currentDiameter * 0.5f); if (userInput) { data.setBottomRadius(currentDiameter * 0.5f); } data.setEnable(true); fairing.updateExternal(data); }
private void updateFairing(bool userInput) { SSTUNodeFairing[] modules = part.GetComponents <SSTUNodeFairing>(); if (modules == null || modules.Length < 2) { MonoBehaviour.print("ERROR: Could not locate both fairing modules for part: " + part.name); return; } SSTUNodeFairing topFairing = modules[0]; if (topFairing != null) { float topFairingBottomY = getTopFairingBottomY(); FairingUpdateData data = new FairingUpdateData(); data.setTopY(getPartTopY()); data.setBottomY(topFairingBottomY); data.setBottomRadius(currentDiameter * 0.5f); if (userInput) { data.setTopRadius(currentDiameter * 0.5f); } topFairing.updateExternal(data); } SSTUNodeFairing bottomFairing = modules[1]; if (bottomFairing != null) { float bottomFairingTopY = getBottomFairingTopY(); FairingUpdateData data = new FairingUpdateData(); data.setTopRadius(currentDiameter * 0.5f); data.setTopY(bottomFairingTopY); if (userInput) { data.setBottomRadius(currentDiameter * 0.5f); } bottomFairing.updateExternal(data); } }
/// <summary> /// Updates the position and enable/disable status of the SSTUNodeFairing (if present). <para/> /// </summary> private void updateFairing(bool userInput) { SSTUNodeFairing fairing = part.GetComponent<SSTUNodeFairing>(); if (fairing == null) { return; } bool enable = !currentMountData.modelDefinition.fairingDisabled; AttachNode node = part.FindAttachNode("top"); // this was an attempt to fix fairing interaction between tanks and engines; // unfortunately it results in the engine fairing being permanently disabled // whenever it is mounted below a tank regardless of the tanks current fairing // status; rendering the fairings completely unusable for the engines even when // they are using a mount that should have fairings enabled. //if (node != null && node.attachedPart != null) //{ // Part p = node.attachedPart; // SSTUNodeFairing[] fs = p.GetComponents<SSTUNodeFairing>(); // int len = fs.Length; // for (int i = 0; i < len; i++) // { // //TODO find lowest node and check for that rather than static bottom reference ? // if (fs[i].nodeName == "bottom" && fs[i].snapToSecondNode)//if it watches bottom node and is set to snap to second node; i.e. it would shroud this engine, so disable the engines' own shroud. // { // enable = false; // break; // } // } //} fairing.canDisableInEditor = enable; FairingUpdateData data = new FairingUpdateData(); data.setTopY(fairingTopY); data.setTopRadius(currentMountDiameter * 0.5f); if (userInput) { data.setBottomRadius(currentMountDiameter * 0.5f); } data.setEnable(enable); fairing.updateExternal(data); }
private void updateFairing(bool userInput) { SSTUNodeFairing fairing = part.GetComponent<SSTUNodeFairing>(); if (fairing == null) { return; } fairing.canDisableInEditor = true; FairingUpdateData data = new FairingUpdateData(); data.setTopY(mainModelData.currentHeight * 0.5f); data.setTopRadius(currentDiameter * 0.5f); if (userInput) { data.setBottomRadius(currentDiameter * 0.5f); } data.setEnable(true); fairing.updateExternal(data); }