コード例 #1
0
        private void UpdateModulePositions()
        {
            lengthWidth = coreModule.definition.lengthWidth;
            float height = lengthWidth ? panelLength : coreModule.moduleHeight;

            if (lengthWidth)
            {
                coreModule.setScaleForHeightAndDiameter(panelLength, panelWidth, lengthWidth);
            }
            else
            {
                coreModule.setScaleForHeightAndDiameter(panelScale, panelScale, lengthWidth);
            }

            coreModule.setPosition(height / 2);
            coreModule.updateModelMeshes(lengthWidth);

            /*
             * if (fullScale)
             * {
             *  ROLLog.debug("UpdateModulePositions() fullScale");
             *  float currentDiameter = coreModule.definition.diameter * panelScale;
             *  coreModule.setScaleForDiameter(currentDiameter, 1);
             *  height = coreModule.moduleHeight;
             *  pos = height * 0.5f;
             *  coreModule.setPosition(pos);
             *  coreModule.updateModelMeshes();
             * }
             * else
             * {
             *  ROLLog.debug("UpdateModulePositions()");
             *  lengthWidth = coreModule.definition.lengthWidth;
             *  ROLLog.debug($"lengthWidth: {lengthWidth}");
             *  if (lengthWidth)
             *  {
             *      coreModule.setScaleForHeightAndDiameter(panelLength, panelWidth, lengthWidth);
             *      height = coreModule.modulePanelLength;
             *  }
             *  else
             *  {
             *      coreModule.setScaleForHeightAndDiameter(panelScale, panelScale, lengthWidth);
             *      height = coreModule.moduleHeight;
             *  }
             *  pos = height * 0.5f;
             *  coreModule.setPosition(pos);
             *  coreModule.updateModelMeshes(lengthWidth);
             * }
             */

            animationName = coreModule.definition.animationName;
            FindAnimations();

            // Allow StartFSM() to configure the animation state (time/speed/weight)
            // Change handler will need to re-call StartFSM() to properly reset a model.

            if (pivotName.Equals("sunPivot"))
            {
                hasPivot = false;
            }

            pivotName = coreModule.GetPivotName();
            panelRotationTransform = part.FindModelTransform(pivotName);
            originalRotation       = currentRotation = panelRotationTransform.localRotation;
            secondaryTransformName = raycastTransformName = coreModule.GetSecondaryTransform();
        }