private void updateModulePositions() { //update for model scale topModule.model.updateScaleForDiameter(topDiameter); coreModule.model.updateScaleForDiameter(coreDiameter); bottomModule.model.updateScaleForDiameter(bottomDiameter); solarModule.model.updateScale(1); //calc positions float yPos = topModule.moduleHeight + (coreModule.moduleHeight * 0.5f); float topDockY = yPos; yPos -= topModule.moduleHeight; float topY = yPos; yPos -= coreModule.moduleHeight; float coreY = yPos; float bottomY = coreY; yPos -= bottomModule.moduleHeight; float bottomDockY = yPos; //update internal ref of position topModule.setPosition(topY); coreModule.setPosition(coreY); solarModule.setPosition(coreY); bottomModule.setPosition(bottomY, ModelOrientation.BOTTOM); //update actual model positions and scales topModule.updateModel(); coreModule.updateModel(); bottomModule.updateModel(); solarModule.updateModel(); }
private void updateModelScale() { modelTransform.localScale = new Vector3(currentScale, currentScale, currentScale); standoffModule.model.updateScaleForDiameter(currentScale * structureScale); standoffModule.setPosition(structureOffset * currentScale - standoffModule.model.currentHeight, ModelOrientation.TOP); standoffModule.updateModel(); }
/// <summary> /// Update the engine scale and position for scale. /// </summary> private void updateEnginePositionAndScale() { engineModels.setScale(currentEngineScale); engineModels.root.localRotation = this.invertEngines ? Quaternion.Euler(180, 0, 0) : Quaternion.identity; engineModels.setPosition(-currentHeight * 0.5f + engineModels.moduleHeight * 0.5f); engineModels.updateModelMeshes(); engineModels.renameEngineThrustTransforms(engineThrustTransformName); }
private void updateModelScale() { rcsBlockModule.setPosition(0); rcsBlockModule.setScale(currentScale); rcsBlockModule.updateModelMeshes(); standoffModule.setDiameterFromAbove(rcsBlockModule.moduleDiameter, 0f); standoffModule.setPosition(rcsBlockModule.moduleBottom - standoffModule.moduleHeight); standoffModule.updateModelMeshes(); }
private void updateModelScale() { if (modelTransform != null) { modelTransform.localScale = new Vector3(currentScale, currentScale, currentScale); } standoffModule.model.updateScaleForDiameter(currentScale * structureScale); float position = -standoffModule.moduleHeight - structureOffset * currentScale; standoffModule.setPosition(position, ModelOrientation.TOP); standoffModule.updateModel(); }
private void initialize() { if (initialized) { return; } initialized = true; double hsp = 1; double dens = 1; PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName); hsp = resource.specificHeatCapacity; dens = resource.density; fluxPerResourceUnit = hsp * ablationEfficiency * dens; baseSkinIntMult = part.skinInternalConductionMult; baseCondMult = part.heatConductivity; ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); Transform mhsRoot = part.transform.FindRecursive("model").FindOrCreate("SSTU-MHS-Root"); ConfigNode[] modelNodes = node.GetNodes("MODELS"); ModelDefinitionLayoutOptions[] models = SSTUModelData.getModelDefinitions(modelNodes); model = new ModelModule <SSTUModularHeatShield>(part, this, mhsRoot, ModelOrientation.CENTRAL, nameof(currentShieldModel), null, nameof(currentShieldTexture), nameof(modelPersistentData), null, null, null, null); model.getSymmetryModule = (m) => m.model; model.setupModelList(models); model.setupModel(); model.setScaleForDiameter(currentDiameter); model.setPosition(0); model.updateModelMeshes(); model.updateSelections(); model.volumeScalar = resourceScalePower; model.massScalar = resourceScalePower; if (standAlonePart) { updateDragCube(); updateAttachNodes(false); } SSTUModInterop.updateResourceVolume(part); ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE"); shieldTypeData = HeatShieldTypeData.load(typeNodes); currentShieldTypeData = Array.Find(shieldTypeData, m => m.baseType.name == currentShieldType); updateModuleStats(); updatePartCost(); SSTUModInterop.onPartGeometryUpdate(part, false); SSTUModInterop.updateResourceVolume(part); SSTUStockInterop.fireEditorUpdate();//update for mass/cost/etc. }
private void updateModulePositions() { //update for model scale topModule.model.updateScaleForDiameter(currentDiameter * coreModule.model.topRatio); coreModule.model.updateScaleForDiameter(currentDiameter); bottomModule.model.updateScaleForDiameter(currentDiameter * coreModule.model.bottomRatio); solarModule.model.updateScale(1); float coreScale = coreModule.model.currentDiameterScale; rcsModule.model.updateScale(coreScale); //calc positions float yPos = topModule.moduleHeight + (coreModule.moduleHeight * 0.5f); yPos -= topModule.moduleHeight; float topY = yPos; yPos -= coreModule.moduleHeight; float coreY = yPos; float bottomY = coreY; yPos -= bottomModule.moduleHeight; float bottomDockY = yPos; //update internal ref of position topModule.setPosition(topY); coreModule.setPosition(coreY); solarModule.setPosition(coreY); bottomModule.setPosition(bottomY, ModelOrientation.BOTTOM); rcsModule.setPosition(coreY + (coreScale * currentRCSOffset * coreModule.model.rcsOffsetRange) + (coreScale * coreModule.model.rcsPosition)); //update actual model positions and scales topModule.updateModel(); coreModule.updateModel(); bottomModule.updateModel(); solarModule.updateModel(); rcsModule.model.currentHorizontalPosition = coreModule.model.currentDiameterScale * coreModule.model.modelDefinition.rcsHorizontalPosition; rcsModule.updateModel(); }
private void initialize() { if (initialized) { return; } initialized = true; double hsp = 1; double dens = 1; if (heatSoak) { PartResourceDefinition resource = PartResourceLibrary.Instance.GetDefinition(resourceName); hsp = resource.specificHeatCapacity; dens = resource.density; } else { resource = part.Resources[resourceName]; if (resource != null) { hsp = resource.info.specificHeatCapacity; dens = resource.info.density; } else { hsp = PhysicsGlobals.StandardSpecificHeatCapacity; dens = 0.005f; } } fluxPerResourceUnit = hsp * ablationEfficiency * dens; baseSkinIntMult = part.skinInternalConductionMult; baseCondMult = part.heatConductivity; ConfigNode node = SSTUConfigNodeUtils.parseConfigNode(configNodeData); //stand-alone modular heat-shield setup if (standAlonePart) { ConfigNode[] modelNodes = node.GetNodes("MODEL"); model = new ModelModule <SingleModelData, SSTUModularHeatShield>(part, this, part.transform.FindRecursive("model"), ModelOrientation.CENTRAL, nameof(modelPersistentData), nameof(currentShieldModel), nameof(currentShieldTexture)); model.setupModelList(SingleModelData.parseModels(modelNodes)); model.setupModel(); model.model.updateScaleForDiameter(currentDiameter); model.setPosition(0, ModelOrientation.CENTRAL); model.model.updateModel(); updateAttachNodes(false); updateDragCube(); } ConfigNode[] typeNodes = node.GetNodes("SHIELDTYPE"); shieldTypeData = HeatShieldTypeData.load(typeNodes); currentShieldTypeData = Array.Find(shieldTypeData, m => m.baseType.name == currentShieldType); updateModuleStats(); updatePartCost(); if (!initializedResources && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight)) { updatePartResources(); initializedResources = true; } }