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


C# Part.GroundParts方法代码示例

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


在下文中一共展示了Part.GroundParts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: calculateDrag

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

            Vector3 cop;
            if (part.GetCoP(out cop) && !part.ShieldedFromAirstream) {
                part.DragCubes.ForceUpdate (false, true);
                part.DragCubes.SetDragWeights ();
                part.DragCubes.SetPartOcclusion ();

                /* direction is the drag direction, despite DragCubes.DragVector being the velocity */
                Vector3 direction = -part.partTransform.InverseTransformDirection (VelocityDirection);
                part.DragCubes.SetDrag (direction, mach);
                float drag = GetDrag(part);
                position += cop * drag;
                Cd += drag;
            }
        }
开发者ID:FormalRiceFarmer,项目名称:KerbalMods,代码行数:20,代码来源:CoDMarker.cs

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