当前位置: 首页>>代码示例>>C#>>正文


C# Part.GetCoM方法代码示例

本文整理汇总了C#中Part.GetCoM方法的典型用法代码示例。如果您正苦于以下问题:C# Part.GetCoM方法的具体用法?C# Part.GetCoM怎么用?C# Part.GetCoM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Part的用法示例。


在下文中一共展示了Part.GetCoM方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: calculateCoM

        protected override void calculateCoM(Part part)
        {
            if (part.GroundParts ()) {
                return;
            }

            Vector3 com;
            if (!part.GetCoM (out com)) {
                return;
            }

            /* add resource mass */
            for (int i = 0; i < part.Resources.Count; i++) {
                PartResource res = part.Resources [i];
                if (!Resource.ContainsKey (res.info.name)) {
                    Resource [res.info.name] = new DCoMResource (res);
                } else {
                    Resource [res.info.name].amount += res.amount;
                }
            }

            /* calculate DCoM */
            float m = part.GetSelectedMass();

            vectorSum += com * m;
            totalMass += m;
        }
开发者ID:FormalRiceFarmer,项目名称:KerbalMods,代码行数:27,代码来源:DCoMMarker.cs

示例2: calculateCoM

        protected override void calculateCoM(Part part)
        {
            if (part.GroundParts ()) {
                return;
            }

            Vector3 com;
            if (part.GetCoM(out com)) {
                float m = part.GetTotalMass ();
                vectorSum += com * m;
                totalMass += m;
            }
        }
开发者ID:FormalRiceFarmer,项目名称:KerbalMods,代码行数:13,代码来源:ComMarker.cs

示例3: calculateMoI

        void calculateMoI (Part part)
        {
            if (part.GroundParts ()) {
                return;
            }

            Vector3 com;
            if (part.GetCoM (out com)) {
                /* Not sure if this moment of inertia matches the one vessels have in game */
                Vector3 distance = transform.position - com;
                Vector3 distAxis = Vector3.Cross (distance, axis);
                value += part.GetTotalMass() * distAxis.sqrMagnitude;
            }
        }
开发者ID:ZiwKerman,项目名称:RCSBuildAid,代码行数:14,代码来源:MomentOfInertia.cs

示例4: PartInfo

 protected void PartInfo(Part part)
 {
     Vector3 com;
     part.GetCoM (out com);
     GUILayout.Label (string.Format (
         "phy: {0} rb: {1} m: {2:F3} cm: {3:F3}\n" +
         "com: {4}",
         part.physicalSignificance,
         part.rb != null,
         part.GetTotalMass(),
         part.GetPhysicslessChildMassInEditor (),
         com));
     var engines = part.FindModulesImplementing<ModuleEngines> ();
     foreach(var engine in engines) {
         GUILayout.Label ("<b>ModuleEngine</b> " + engine.engineID);
         GUILayout.Label (string.Format (
             "min thrust: {0} max thrust: {1}\n" +
             "vac isp: {2} asl isp: {3}",
             engine.minThrust, engine.maxThrust,
             engine.atmosphereCurve.Evaluate (0f),
             engine.atmosphereCurve.Evaluate (1f)));
     }
     var enginesfx = part.FindModulesImplementing<ModuleEnginesFX> ();
     foreach(var engine in enginesfx) {
         GUILayout.Label ("<b>ModuleEngineFX</b> " + engine.engineID);
         GUILayout.Label (string.Format (
             "min thrust: {0} max thrust: {1}\n" +
             "vac isp: {2} asl isp: {3}",
             engine.minThrust, engine.maxThrust,
             engine.atmosphereCurve.Evaluate (0f),
             engine.atmosphereCurve.Evaluate (1f)));
     }
 }
开发者ID:Alewx,项目名称:RCSBuildAid,代码行数:33,代码来源:MenuDebug.cs

示例5: PartInfo

 protected void PartInfo(Part part)
 {
     Vector3 com;
     part.GetCoM (out com);
     GUILayout.Label (string.Format (
         "phy: {0} rb: {1} m: {2:F3}t cm: {3:F3}t\n" +
         "pm: {4:F3}t rm: {5:F3} mm: {6:F3}t\n" +
         "com: {7}\n" +
         "max_drag: {8:F3} AreaDrag: {9:F3}\n" +
         "dvector: {10}",
         part.physicalSignificance,
         part.rb != null,
         part.GetTotalMass (),
         part.GetPhysicslessChildMassInEditor (),
         part.mass,
         part.GetResourceMass (),
         part.GetModuleMass (part.mass),
         com,
         part.maximum_drag,
         part.DragCubes.AreaDrag,
         part.DragCubes.DragVector
     ));
     var engines = part.FindModulesImplementing<ModuleEngines> ();
     foreach(var engine in engines) {
         GUILayout.Label ("<b>ModuleEngine</b> " + engine.engineID);
         GUILayout.Label (string.Format (
             "min thrust: {0} max thrust: {1}\n" +
             "vac isp: {2} asl isp: {3}",
             engine.minThrust, engine.maxThrust,
             engine.atmosphereCurve.Evaluate (0f),
             engine.atmosphereCurve.Evaluate (1f)));
     }
     var enginesfx = part.FindModulesImplementing<ModuleEnginesFX> ();
     foreach(var engine in enginesfx) {
         GUILayout.Label ("<b>ModuleEngineFX</b> " + engine.engineID);
         GUILayout.Label (string.Format (
             "min thrust: {0} max thrust: {1}\n" +
             "vac isp: {2} asl isp: {3}",
             engine.minThrust, engine.maxThrust,
             engine.atmosphereCurve.Evaluate (0f),
             engine.atmosphereCurve.Evaluate (1f)));
     }
 }
开发者ID:FormalRiceFarmer,项目名称:KerbalMods,代码行数:43,代码来源:MenuDebug.cs

示例6: calculateCoM

        protected override void calculateCoM(Part part)
        {
            if (part.GroundParts ()) {
                return;
            }

            Vector3 com;
            if (!part.GetCoM (out com)) {
                return;
            }

            float m = part.GetDryMass ();

            /* add resource mass */
            for (int i = 0; i < part.Resources.Count; i++) {
                PartResource res = part.Resources [i];
                if (!Resource.ContainsKey (res.info.name)) {
                    Resource [res.info.name] = new DCoMResource (res);
                }
                else {
                    Resource [res.info.name].amount += res.amount;
                }
                // Analysis disable once CompareOfFloatsByEqualityOperator
                if (res.info.density == 0) {
                    /* no point in toggling it off/on from the DCoM marker */
                    continue;
                }
                if (Settings.GetResourceCfg (res.info.name, false) || !res.flowState) {
                    /* if resource isn't in the cfg, is a likely a resource added by a mod
                     * so default to false */
                    m += (float)(res.amount * res.info.density);
                }
            }

            vectorSum += com * m;
            totalMass += m;
        }
开发者ID:khr15714n,项目名称:RCSBuildAid,代码行数:37,代码来源:ComMarker.cs


注:本文中的Part.GetCoM方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。