本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}