protected virtual void updateAttachNodes(bool userInput) { currentNoseModule.updateAttachNodes(part, topNodeNames, userInput, ModelOrientation.TOP); currentMountModule.updateAttachNodes(part, bottomNodeNames, userInput, ModelOrientation.BOTTOM); AttachNode surface = part.srfAttachNode; if (surface != null) { Vector3 pos = currentMainTankModule.modelDefinition.surfaceNode.position * currentMainTankModule.currentDiameterScale; Vector3 rot = currentMainTankModule.modelDefinition.surfaceNode.orientation; SSTUAttachNodeUtils.updateAttachNodePosition(part, surface, pos, rot, userInput); } if (!String.IsNullOrEmpty(interstageNodeName)) { float y = currentMountModule.currentVerticalPosition + (currentMountModule.modelDefinition.fairingTopOffset * currentMountModule.currentHeightScale); Vector3 pos = new Vector3(0, y, 0); SSTUSelectableNodes.updateNodePosition(part, interstageNodeName, pos); AttachNode interstage = part.findAttachNode(interstageNodeName); if (interstage != null) { Vector3 orientation = new Vector3(0, -1, 0); SSTUAttachNodeUtils.updateAttachNodePosition(part, interstage, pos, orientation, userInput); } } }
private void updateAttachNodes(bool userInput) { topModule.model.updateAttachNodes(part, topNodeNames, userInput, ModelOrientation.TOP); bottomModule.model.updateAttachNodes(part, bottomNodeNames, userInput, ModelOrientation.BOTTOM); Vector3 pos = new Vector3(0, getTopFairingBottomY(), 0); SSTUSelectableNodes.updateNodePosition(part, noseInterstageNode, pos); AttachNode noseInterstage = part.FindAttachNode(noseInterstageNode); if (noseInterstage != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, noseInterstage, pos, Vector3.up, userInput); } float bottomFairingTopY = getBottomFairingTopY(); pos = new Vector3(0, bottomFairingTopY, 0); SSTUSelectableNodes.updateNodePosition(part, mountInterstageNode, pos); AttachNode mountInterstage = part.FindAttachNode(mountInterstageNode); if (mountInterstage != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, mountInterstage, pos, Vector3.down, userInput); } }
/// <summary> /// Update the attach node positions based on the current tank parameters. /// </summary> private void updateNodePositions(bool userInput) { AttachNode topNode = part.FindAttachNode("top"); if (topNode != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, topNode, new Vector3(0, partTopY, 0), topNode.orientation, userInput); } AttachNode bottomNode = part.FindAttachNode("bottom"); if (bottomNode != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, bottomNode, new Vector3(0, partBottomY, 0), bottomNode.orientation, userInput); } Vector3 pos = new Vector3(0, topFairingBottomY, 0); SSTUSelectableNodes.updateNodePosition(part, noseInterstageNode, pos); AttachNode noseInterstage = part.FindAttachNode(noseInterstageNode); if (noseInterstage != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, noseInterstage, pos, Vector3.up, userInput); } pos = new Vector3(0, bottomFairingTopY, 0); SSTUSelectableNodes.updateNodePosition(part, mountInterstageNode, pos); AttachNode mountInterstage = part.FindAttachNode(mountInterstageNode); if (mountInterstage != null) { SSTUAttachNodeUtils.updateAttachNodePosition(part, mountInterstage, pos, Vector3.down, userInput); } if (userInput) { //TODO -- cache prev tank diameter somewhere, use that for child offset functionality //SSTUAttachNodeUtils.updateSurfaceAttachedChildren(part, null, currentTankDiameter); } }