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