本文整理汇总了C#中Part.GetTotalMass方法的典型用法代码示例。如果您正苦于以下问题:C# Part.GetTotalMass方法的具体用法?C# Part.GetTotalMass怎么用?C# Part.GetTotalMass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Part
的用法示例。
在下文中一共展示了Part.GetTotalMass方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: 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;
}
}
示例3: 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)));
}
}
示例4: printMassInfo
void printMassInfo(Part part)
{
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("part", GUILayout.Width (w));
GUILayout.Label (part.partInfo.name);
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("mass", GUILayout.Width (w));
GUILayout.Label (part.mass.ToString ("F3"));
}
GUILayout.EndHorizontal ();
var m = part.partInfo.partPrefab.mass;
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("p. mass", GUILayout.Width (w));
GUILayout.Label (m.ToString ("F3"));
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("module", GUILayout.Width (w));
GUILayout.Label (part.GetModuleMass (m).ToString ("F3"));
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("resource", GUILayout.Width (w));
GUILayout.Label (part.GetResourceMass ().ToString ("F3"));
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("childs", GUILayout.Width (w));
GUILayout.Label (part.GetPhysicslessChildMassInEditor ().ToString ("F3"));
}
GUILayout.EndHorizontal ();
GUILayout.BeginHorizontal ();
{
GUILayout.Label ("total", GUILayout.Width (w));
GUILayout.Label (part.GetTotalMass ().ToString ("F3"));
}
GUILayout.EndHorizontal ();
}
示例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)));
}
}