本文整理汇总了C#中CelestialBody.GetOrbit方法的典型用法代码示例。如果您正苦于以下问题:C# CelestialBody.GetOrbit方法的具体用法?C# CelestialBody.GetOrbit怎么用?C# CelestialBody.GetOrbit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CelestialBody
的用法示例。
在下文中一共展示了CelestialBody.GetOrbit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCelestialState
public json getCelestialState(CelestialBody celestial)
{
Debug.Log ("Collecting: " + celestial.GetName ());
json buffer = new json ();
buffer.Add ("type", "celestial");
buffer.Add ("name", celestial.GetName ());
buffer.Add ("ref", celestial.referenceBody.GetName ());
if (celestial.orbitDriver != null) {
Orbit orbit = celestial.GetOrbit ();
Vector3d r = orbit.getRelativePositionAtUT (0);
Vector3d v = orbit.getOrbitalVelocityAtUT (0);
List<double> RV = new List<double> ();
// Swap coordinate system
RV.Add (r.y);
RV.Add (r.x);
RV.Add (r.z);
RV.Add (v.y);
RV.Add (v.x);
RV.Add (v.z);
buffer.Add ("rv", RV);
} else {
List<double> RV = new List<double> ();
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
RV.Add (0.0);
buffer.Add ("rv", RV);
}
buffer.Add ("mu", celestial.gravParameter);
buffer.Add ("radius", celestial.Radius);
buffer.Add ("soi", celestial.sphereOfInfluence);
if (celestial.atmosphere == true) {
buffer.Add ("alt_atm", celestial.maxAtmosphereAltitude);
} else {
buffer.Add ("alt_atm", 0);
}
// Angular velocity data
buffer.Add ("ang_v", celestial.zUpAngularVelocity.magnitude);
buffer.Add ("initial_rotation", celestial.initialRotation);
buffer.Add ("rotation_angle", celestial.rotationAngle);
buffer.Add ("rotation_t0", Planetarium.GetUniversalTime ());
return buffer;
}